First Circular Meet


  • 2

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


  • 0

    Plz provide the approach for this problem.


  • 0

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


  • 1

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

    1. find the largest common divisor d for a - b and n.
    2. time = n / d
      done

  • 0
    This post is deleted!

  • 0

    @xidui
    Thanks


Log in to reply
 

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