educative.io

Educative

When product is bigger than target, why do we set the upperbound for left pointer to length of the arrary

i don’t get this line:
while (product >= target and left > len(arr)):

why not:
while (product >= target and left > right:

both passes the tests

from my understanding, window should not exceed the right index when we are moving along the array. What am i missing here?

Thanks!

2 Likes

hi @take2 ,

Thank you so much for reaching out to us and thank you so much for letting us know about the the condition and we have updated this in our course. If you find more of such things, please do let us know. Thank you.