Question is worded poorly, not enough instruction

  • 0

    The language is very unclear, particularly:
    "Assume the first element of the array is forward next to the last element, and the last element is backward next to the first element."

    What is this trying to say? If it is trying to indicate direction of traversal, use left to right / right to left to indicate direction.

    The first example is also unclear, because it has not defined the behavior of taking steps beyond the boundaries of the array. If the array is [2, -1, 1, 2, 2], I would go from index 0 -> 2 -> 3, at which point I would have to take 2 steps to exit the boundaries of the array. What about this last step makes this a loop?

  • 0

    @kurifu Well, the problem is in draft mode, so don't expect too much. Indeed, adding a constraint "forward" or "backward" loop makes a little more complicate. If we just remove this and allow any type of loop (except self-loop), then the code is simpler IMO.

Log in to reply

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