1->2->3->4->5, n=3 ==> 1->2->4->5
1->2->3->4->5, n=1 ==> 1->2->3->4
1->2->3->4->5, n=5 ==> 2->3->4->5
1. Find length of the List.
2. Use length-n+1 to find nth node from the end.
3. Traverse the List
to find the nth from the end node and remove it. Removal can be done by pointing the Previous
node's next reference to Current
node's next reference.
public ListNode removeNthFromEnd(ListNode head, int n) { }
C
Java
Python