Remove Nth Node From End of List
Recognize the pattern
Brute force idea
If you approach Remove Nth Node From End of List in the most literal way possible, you get this: Count length, compute position from start, remove — two passes. It is a fair place to begin because it matches the surface of the question, yet it does not capture the deeper structure that makes the problem simpler.
Better approach
The real unlock in Remove Nth Node From End of List comes when you notice this: Two pointers n apart: when fast reaches end, slow is at the node before the target — single pass. Instead of recomputing the world every time, you preserve just enough context to let the next decision become obvious.
Key invariant
The compass for Remove Nth Node From End of List is this: If fast is n nodes ahead of slow, when fast reaches the end, slow is at position length - n. As long as that statement keeps holding, you can trust the steps built on top of it.
Watch out for
The trap in Remove Nth Node From End of List usually looks like this: Forgetting the dummy head — needed when removing the actual head node. When the code becomes mechanical before the idea is clear, small edge cases start breaking the whole story.