Linked list cycle detection: A linked structure is represented by a next array where each entry is another index or null. Starting at head, return whether traversal enters a cycle.
Input: A JSON object { "next": (number|null)[], "head": number|null }.
Output: A JSON boolean.
Constraints:
- 0 <= next.length <= 100000
- Every non-null next index is within bounds
- head is null or a valid index
Read one JSON value from stdin and print exactly one JSON-serialized answer to stdout with no extra text.
Difficulty: HARD. Variant: 18. Favor a pragmatic solution that is easy to ship, read, and adapt.
Practice context
This coding (algo) exercise trains prompt interpretation, explicit assumptions, a concrete response, and a concise explanation of the decisions made. It is marked hard difficulty.
The signed-in workspace provides the tools required by the round, such as recording, code exec