NumPy allowed · plain Python earns 10 bonus points
Implement Floyd's Tortoise and Hare cycle detection -- two pointers moving at different speeds are GUARANTEED to meet inside any cycle, using O(1) extra space instead of an O(n)-space visited-set.
Implement has_cycle(values, pos): build the linked list from values, wiring the last node's next to index pos if pos != -1. Then walk a slow pointer one step at a time and a fast pointer two steps at a time; if they ever point to the exact same node, a cycle exists.
has_cycle(values: list[int], pos: int) -> bool