id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > quizSLAPHL_P5
prev  |  next  |  chance

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)

public int quizSLAPHL_P5(int[] nums) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 299

Copyright Nick Parlante 2017 - privacy