head and a number k. Remove the node that is k-th when counting from the end (the last node is the 1st from the end) and return the head of the updated list. If the removed node was the only one, return an empty list.
Try to do it in a single pass over the list.head=list_node([6, 0, 8, 3]), k=3 → [6, 8, 3]
Counting from the end: 3 is first, 8 second, 0 third. That one is removed.
head=list_node([42, 17]), k=2 → [17]
The second node from the end is the head, so the list now starts at 17.
head=list_node([5]), k=1 → None
The only node is removed and the list becomes empty.
head=list_node([6, 0, 8, 3]), k=3
[6, 8, 3]
Run checks the first 3 tests in your browser. Submit checks all 79 tests on the server, hidden ones included.