Join Two Lists
Return one list made of all the nodes of l1 followed by all the nodes of l2, each in its original order. Either list may be empty.
Linked lists appear in the tests as the list of their values, like [1,2,3]. Each node is a ListNode with .val and .next; the class is already defined for you.
Example 1
l1 [1,2]
l2 [3,4]
returns [1,2,3,4]
1, 2, 3, 4.
Example 2
l1 []
l2 [5]
returns [5]
The first list is empty.
Constraints
0 <= nodes in each list <= 50-100 <= Node.val <= 100
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.