Simple sum
Input
[1, 2, 3]
Output
6
1 + 2 + 3 = 6
Full lesson preview
Implement a recursive function to compute the sum of elements in a list.
Problem statement
Task
Examples
Input
[1, 2, 3]
Output
6
1 + 2 + 3 = 6
Input format
Output format
Constraints
Samples
Input
[]
Output
0
Empty list sums to 0.