Remove Nth Node From End Of Linkedlist

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

Input Format

1->7->2->6->3->5->4->null 2

Output Format

1->7->2->6->3->4->null

Constraints

1 <= size Of LinkedList <= 10^6
1 <= n <= 10^6

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
9
18 1 16 11 15 7 9 16 4 
1
Output
18 1 16 11 15 7 9 16 
Previous
Segregate Even And Odd Nodes In A Linkedlist
Next
Merge K Sorted Linkedlist

Related Questions