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

 

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

Write a method that adds all of the integers in an array and returns the sum. The only catch is that you must use... a herring!!! Oh, no! I mean: You must use RECURSION. Not only that, but your main method cannot be recursive, so you must use a recursive helper method. And also provide a shrubbery. Just kidding about the shrubbery. But you really must have a recursive helper method.


stingSimonArrayAdd([5, 10, 15, 30, 60]) → 120
stingSimonArrayAdd([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) → 210
stingSimonArrayAdd([50, 50, 100, 1000, 3000]) → 4200

...Save, Compile, Run (ctrl-enter)

public int stingSimonArrayAdd(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: 290

Copyright Nick Parlante 2017 - privacy