Question: 5 9 mleft Sum Them All Linked List Write a function that traverses a singly - linked list finding the ALL sum of all the
mleft
Sum Them All Linked List
Write a function that traverses a singlylinked list finding the ALL sum of all the integers in each node. Each node instance, a LinkedListNode, has an integer, data, and a pointer to the next node, next. Given a reference to the head of a singly
i linked list, find the sum.
Function Description
Complete the function linkedListSum in the editor below.
linkedListSum has the following parameters:
head: reference to the head of a singlylinked list of integers
Returns:
int: an integer of the sum
Constraints
LinkedListNode.data
LinkedList size
Input Format for Custom Testing
Sample Case
Sample InputSample OutputTest ResultsCustom InputLine: Run CodeRun Tests
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
