Given a linked list, find the sum of its elements.
Definition of a single linked list:
Implement function sum that finds the sum of linked list elements.
The sum of elements of a linked list is 6.