Mid Linked Lists DSA & Coding Interviews

How do you remove the Nth node from the end of a linked list?

Short answer: Two pointers with a gap of n. Advance fast n steps, then move both until fast hits the end; slow.next is the node to delete. One pass, O(1) space.

Edge cases to mention

  • Remove head (n == length)
  • Single node list
  • n = 1 (remove tail)
Use a dummy head so deleting the real head is uniform.
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details