Standard Bar Linked List · Medium Problems of LL O(N) · O(1)
A plant inspection line is a one-way chain of stations, and the QA lead wants a second team dispatched from the exact midpoint to halve the work. The line has no length posted, and with an even station count the tie goes to the later of the two central stations. Send back the remaining chain that starts at that station.
Input: An array head of node values representing the linked list.
Output: The values of the list starting at the middle node; with two middles, start at the second one.
1 <= list length <= 10^5-10^9 <= node value <= 10^9Input: {"head":[1,2,3,4,5]}
Output: [3,4,5]
Five stations split at the third — the sole middle node.
Input: {"head":[1,2,3,4,5,6]}
Output: [4,5,6]
Six stations have two middles (3 and 4); the later one wins the split.