3 ms·
You could use a cycle-detection algorithm like the tortoise and hare, to avoid needing to keep a list of previous results etc. https://en.wikipedia.org/wiki/Cyc
by Retr0id 4y ago
You could use a cycle-detection algorithm like the tortoise and hare, to avoid needing to keep a list of previous results etc. https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_tortoise_and_hare https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_tortoi...