about | help | code help+videos | done | prefs |
Write a method that returns 'true' if it is possible to make the 'product' by multiplying any combination of numbers from the array 'nums'. Return 'false' if it NO combination of numbers from 'nums' can multiply together to make 'product'. You MAY use recursion, but it is not required. As a precondition, you may assume that 'product' will be less than MaxInt. Wow! This wasn't bad to do recursively, but it sure took a long time to make good test data. Please note: If 'product' appears in the array 'nums' that would also return true. In that case there is no multiplication happening, but it still counts as true. Be careful! If you do this the wrong way you may encounter problems with exceeding MaxInt. Remember that intergers "wrap around" so that exceeding MaxInt will often make the new value into a large negative integer. test2020_10_15_Bonus_foundProduct([2, 4, 8, 16, 32, 64, 128, 256], 268435456) → true test2020_10_15_Bonus_foundProduct([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73], 13359) → true test2020_10_15_Bonus_foundProduct([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73], 14514) → true ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy