Why [-1, -2, -3, -4, -5] expects false?


  • 0
    V

    Why the test engine expects false for the following input?

    [-1, -2, -3, -4, -5]

    Isn't there a loop?

    if you start at -1@0

    -1@0 -> (circle back) -5@4 -> comes back to -5@4 (direction is backwards all the time)

    Or have I understood the question wrong?


  • 0
    V

    Any ideas folks?


  • 1
    S

    Because in the sequence -1,-5,-5,-5.. there should be more than 1 number in between the loop. Eg, if there was -5,x,y,z,-5 this would be a loop or -5,x,y,-5 would be a loop too.But -5,-5,-5 or -5,x,-5 is not a loop as mentioned in the question.


  • 0
    V

    Gotcha. Thanks @sujiths52


Log in to reply
 

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