Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

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.?

Plz provide the approach for this problem.

Which company? Would you please add a tag to specify the company of this problem?

Let's assume a > b. The problem means that we need to find a number time that satisfy time * (a - b) % n == 0.

time

time * (a - b) % n == 0

d

a - b

n

time = n / d

@xidui Thanks

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.