You are given a circular linked-list of n nodes. Two pointers start from the same node. One moves a steps at a time and other moves b steps at a time. On which node (with respect to start node) will they meet for the first time.?
Let's assume a > b. The problem means that we need to find a number
time that satisfy
time * (a - b) % n == 0.
- find the largest common divisor
a - band
time = n / d
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.