2 ms·
Odd. The "teleporting turtle" was the first solution to this problem that I thought I had recalled after being reminded of it in this link, but when I read the
by barrkel 17y ago
Odd. The "teleporting turtle" was the first solution to this problem that I thought I had recalled after being reminded of it in this link, but when I read the tortoise / hare solution, I knew this was the original solution I had read when I first heard about this problem.
In other words, while trying to remember the details of the tortoise and hare solution, I turned it into the described teleporting turtle solution, the intuition being that doubling the length of the cycle check would amortize to constant time per link.