Combinations of Integers
You are given an array of integers and an integer K as arguments. Return true if any combination of integers and operations between those integers result in the integer K.
Requirements
- Must return either true or false
- Must be able to handle addition, subtraction, division and multiplication operations
Example #1
solve([2,2,1], 3)
> true
*There are 5 operations that could result in 3: 2-(1-2), 2+(2-1), (2\2)-1, (2+2)-1, (2-1)+2
Example #2
solve([1,0,44], 9)
> false
There are no combinations of operations using the numbers in the given array that could result in 9