Comment

Comment by thaumasiotes

> If you check every node that the hare enters, you don't need the relative speed to be coprime to the cycle-length. This eliminates the need for the hare and tortoise to finish a round on the same node

> This change adds a performance penalty with the extra equality checks, but can reduce the total number of steps in certain contexts

The post seems to think that most of the value in this approach comes from the fact that it's easy to identify the beginning of the cycle after you've identified that the cycle exists. The method relies on the tortoise and hare finishing a round on the same node. Does that generalize to the case where the hare just passes the tortoise at some point?

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton