134. Where Does the Cycle Start?
The input is built the same way as the previous problem: n values, then an
integer c which is -1 for no cycle, or the 0-based position the last node loops back to.
Print the 0-based position where the cycle begins, or -1 if there is no cycle.
Do not use extra memory proportional to the list.
Constraints - `0 ≤ n ≤ 100000` - `-1 ≤ c < n` - `-1000000 ≤ value ≤ 1000000`
Input
The first line contains an integer n, the number of nodes.
The second line contains n space-separated integers — the node values from head to tail.
The starter code builds the list for you; work on the nodes, not the array.
The third line contains an integer j. If j is -1 the list stays straight; otherwise the last node is linked back to the node at 0-based position j.
Output
Print one integer — the 0-based position where the cycle begins, or -1 if there is no cycle.