Practice · 4 of 5
Recursive array sum
CHALLENGE
Difficulty: beginner+25 XP
Implement int asum(int[] arr, int i) recursively: the sum of arr[i..]. Base case i == arr.length returns 0 (the empty contribution), otherwise arr[i] + asum(arr, i + 1).
Press Submit to check your solution.
Back to lesson: Practice: Recursion reps