about | help | code help+videos | done | prefs |
You MUST use recursion in a non-trivial way to solve this problem. Is it possible to separate the integers in an array into two groups such that one of the groups has an odd number of numbers while the other group has an even number of numbers, and the sum of the numbers in each group is the same total? Return 'true' if it IS possible. Return 'false' if it is NOT possible. I strongly encourage you to use a helper method. Also, in some cases you might be able to know that it is not possible without doing a whole lot of work or even calling the recursive helper method! As a precondition you may assume the array will contain at least one number, and that all numbers in the array will be positive. You may use non-recursive parts for this program, as long as the bulk of the meaningful solution is recursive. You may even use a loop or two if you want to. But remember, the recursive part must not be trivial or recursion for its own sake. dec1_2017_HL_evenOdd([241, 43, 643, 7, 42, 342, 43, 152, 54, 8, 542, 64, 865, 124, 86, 5, 64, 352, 241]) → true dec1_2017_HL_evenOdd([2000, 5000, 1000, 500, 500, 3000, 750, 750, 500]) → true dec1_2017_HL_evenOdd([5, 5]) → false ...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: 440
Copyright Nick Parlante 2017 - privacy