Hello Everyone, Can anyone clarify when we are using binary search. Sometimes in the while loop We write while(l<r) and sometimes we write while (l<=r) depending from question to question ofc.
But I always get pretty confused between the two and ended up either wasting too much time or making many wrong submissions. is there a clear cut distinction like when we should use the first one and when we should use the second one?
Questions like these confuses me a lot https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/
Thanks!