I feel that the case
[2,-2,2,-2,-1] should return true. Maybe I am mis-understanding the problem statement, but there seems to be a backward loop here.
@dribvurhd There are lots of posts discussing this problem now -
one-single-direction should be the key.
The reason I think it should return
true is because there is a loop in the reverse direction, namely
-2, -1, -2 at index
1, 4, 3, 1. Am I missing something? That loop seems to be in the right to left direction.
@StefanPochmann Good to know. I assumed that the "question setter's solution" was just one single solution in one language. Didn't know that it had to be provided in multiple languages.
@dribvurhd I don't think it has to be provided in multiple (but in this case it apparently is, at least in two different languages).
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.