Problem. Given the head of a singly linked list and an integer n, remove the n-th node from the end and
return the head. n is between 1 and the length.
1 → 2 → 3 → 4 → 5, n = 2 → 1 → 2 → 3 → 5
1, n = 1 → None
1 → 2, n = 2 → 2 (the head itself is removed)
Two difficulties: you don't know the length, and to delete a node you need its predecessor. Which could be "the node before the head", hence the dummy node from lesson 7.1.
ML context. "The n-th from the end" is a recency question: the checkpoint from three saves ago, the batch five steps back when the loss spiked, the last k log lines before a crash. In a stream you can't go back, so you keep exactly n items in a ring buffer (Change D), the same fixed-gap idea in another form.