educative.io

Why is -1 a disqualifying value is fast slow pointers circular array loop

Wouldn’t an array of [-1, -1, -1] be a circular array loop.
Why isn’t 1 a disqualifying value as well?

Hello Kostas,

An array of {-1, -1, -1} is a circular array loop. When we start evaluating the array, the direction of the pointers will remain the same when moving throughout the array which is backward. The pointers do not change its direction at any point while traversing through the array.
For this array, if we had 1 in the array as well. it would count towards the dis qualifying value and the array won’t be a circular array loop.