< 99 Elm Problems

Given a list of integer numbers, find a correct way of inserting arithmetic signs (operators) such that the result is a correct equation, if possible. Example: [2,3,5,7,11] we can form the equations 2-3+5+7 = 11 or 2 = (3*5+7)/11 (and ten others).

Division should be interpreted as operating on rationals, and division by zero should be avoided.

# # # THIS IS A STUB # # #

Example in Elm:
import Html exposing (text)
import List

f : Int -> Int
-- your implementation goes here

main = text (toString (f 0))

Result:

4

Solutions

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.