Not understanding the example of a "loop"


  • 0
    M
    Example 1: Given the array [2, -1, 1, 2, 2], there is a loop, from index 0 -> 2 -> 3 -> 0.
    
    Example 2: Given the array [-1, 2], there is no loop.
    

    I'm not sure quite how to determine when I've found a loop in this problem. It would seem to me that given the array [-1, 2], you would go from index 0 -> 1 -> 1 -> 1 -> ...

    Could someone explain what makes the first example a loop and the second example not?


  • 0
    K

    same here. i also don't get it.


Log in to reply
 

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