0

Problem Statement

In this challenge, you need to create a recursive function sum which returns the total sum of the integers in a List.

The provided skeleton code uses match and you are required to use the skeleton code. However, there is an alternate solution to this problem which we will discuss in the solution review.

Input

The input of the function is a List of integers numberList.

Output

The output will be the sum of all the integer in numberList.

Sample Input

List(1,2,3,4,5)

Sample Output

15

Test Yourself

Write your code in the given area. Try the exercise by yourself first, but if you get stuck, the solution has been provided. Good luck!

Source: Grepper

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.

Grepper Account Login Required