目次
LeetCode #142
This solution is not intuitional. I proved using modulo arithmetic.
Proof
Let be the index of the node where fast pointer and slow pointer meets.
Let be the index of the tail.
Let be the index of the node that tail's next pointer is connected to.
Lemma
Proof.
From the definition of :
From the definition of and:
Therefore,