Remove Nth Node from End
mediumRemove the nth node from the end of a linked list in one pass
Remove Nth Node From End
Key Insight
Create an N-node gap between two pointers, then the trailing pointer lands at the target
Step 1Setup with Dummy
n = 2
fast
slow
D
1
2
3
4
5
null
Add dummy before head. Both pointers start at dummy. n=2 means remove 2nd from end.
1 / 6