Medium
Remove the nth node from the end in one pass.
Given a linked list head, remove the nth node from the end of the list and return the new head.
Examples
Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]
Constraints
- 1 <= n <= list size
Coding Challenge
Remove the nth node from the end in one pass.
Given a linked list head, remove the nth node from the end of the list and return the new head.
Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]
Preparing your coding workspace...