about | help | code help+videos | done | prefs |
Write a method that recursively applies the concept of a "partial sum array" (as in the previous problem) but with a slight difference. Each partial sum array leaves off the first partial sum... so the partial sum array for {4, 2, 8, 1} would be {6, 14, 15} (leaving off the first partial sum of 4). The recursive part is that you would then compute the modified partial sum array for {6, 14, 15} which would be {20, 35} and then compute for that array which would be {55}. When the array is down to a single number, you simply return that number as an integer. quizSLAPHL_P5([15, -15, 2, -4]) → 2 quizSLAPHL_P5([13, 4]) → 17 quizSLAPHL_P5([4, 2, 8, 1]) → 55 ...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: 299
Copyright Nick Parlante 2017 - privacy