16. Middle of a Linked List
EasyLinked lists
Return the middle node of a linked list (as a list from that node onward). With two middle nodes, return the second.
A linked list is passed as ListNode objects with val and next. The tests write lists as arrays.
Example 1
Input: head = [1, 2, 3, 4, 5] Output: [3, 4, 5]
Example 2
Input: head = [1, 2, 3, 4] Output: [3, 4]
Constraints
1 ≤ nodes ≤ 100