Create Gap
Move fast n steps ahead so the distance between fast and slow equals n.
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
Delete Nth Node From End keeps a fixed gap between fast and slow pointers so slow lands just before the node to remove.
Move fast n steps ahead so the distance between fast and slow equals n.
When fast reaches null, slow is before the deletion target.
The removal is one pointer rewrite: slow.next = slow.next.next.
A dummy node handles deleting the actual head cleanly.