Loop detection failure case


  • 0
    J

    For example, the following case doesn't create a loop even with the duplication.

    [4, 3, 5, 2, 2]

    0->4->2->5

    0->3->2->5

    Does the loop detection approach still work with a modification?


  • 0
    X

    According to the instruction, the array length is 5, the elements should be in the range of [1,4] (inclusive).


Log in to reply
 

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