Problem
Given the head of a linked list and a number n, remove the nth node **counting from the end** (n = 1 is the last node) and return the head of the resulting list. Try to do it in one pass.
Example 1
- Input
- 1
- Output
- 2 -> 3 -> 4 -> 5, n = 2 → 1 -> 2 -> 3 -> 5
Example 2
- Input
- 1, n = 1
- Output
- (empty)
Example 3
- Input
- 1
- Output
- 2, n = 2 → 2
If nothing is left, return None (null in TypeScript).
Constraints
1 <= number of nodes <= 301 <= n <= number of nodes0 <= Node.val <= 100