Remove Nth Node
LINKED LIST

Problem

Given the head of a linked list, remove the nth node from the end of the list and return its head.

Examples

removeNodes([1,2,3,4,5,6,7,8,9,10], 5); // returns [1,2,3,4,5,7,8,9,10] // The 5th node from the end is 6 removeNodes([1,2,3,4,5,6], 3); // returns [1,2,3,5,6] // The 3rd node from the end is 4
Loading...