Remove the n-th node from the end of the list (the last node is n = 1) and return the head. Do it in one pass.
The tests show a list as a Python list of its values: [1, 2, 3] stands for 1 -> 2 -> 3.
Example 1
Input:
remove_nth_from_end(head, 2) # head = 1 -> 2 -> 3 -> 4 -> 5
Output:
[1, 2, 3, 5]
Example 2
Input:
remove_nth_from_end(head, 1) # head = 1
Output:
[]
1 <= number of nodes <= 1000001 <= n <= number of nodes-10**9 <= val <= 10**9No results yet
Run your code to check it against the examples, or submit to run every test.