Remove the n-th node from the end in a single pass, no length count.
Give fast an n-node head start; once the gap is set,
walk slow and fast together — when fast
hits the end, slow is right before the node to remove.
Execution
idle
Press Run to begin.
0 / 0
Speed
Java · running line
dummyslow 🐢fast 🐇node to remove
O(n) time · O(1) space · the dummy node exists purely so "removing the head" isn't a special case.