I have been trying to understand LinkedList problems when it comes to Java but I am confused about how the Collection List/LinkedList API plays into them. I understand the concept of nodes and what a LinkedList is, but it feels like the exercises I am doing are too low-level and not related to the Java Collections List/LinkedList API. When I search the API for "node", I don't get any results.
Does any of this actually have to do with java Collections List/ LinkedList api? it doesn't seem so. For example if I search the LinkedList api for "node", I don't even get a single hit.
Take the following question:
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Example
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Explanation: 342 + 465 = 807.
When I read the question, I wrote out the code for a solution on my whiteboard. To my surprise, the answer I had written was already different from the solution in the very first line!
I wrote the following:
```
public LinkedList<Integer> addLinkedLists(LinkedList<Integer> l1, LinkedList<Integer> l2)
```
and the solution had the following:
```
public ListNode addTwoNumbers(ListNode l1, ListNode l2)
```
Question resource: https://www.interviewbit.com/java-interview-questions/
Can you provide more details about the solution you are referring to? What is the expected output of the solution? What implementation of LinkedList is the solution supposed to use?