Could sb tell me why if the Linked List has a cycle walker and runner will meet at some point?


  • 0
    T

    it is not intuitive for me... thanks a lot


  • 0
    P

    (3+2t)-(1+t)=m //t represents the step to walk before they meet
    m=n*x //x represents the numbers of elements in the cycle
    2+t=m
    m must >2
    so there must have a t to make the 2+t=m true.


Log in to reply
 

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