Find Upper and Lower bound (testcase wrong)
Hi @vikashkmr519,
You cannot apply binary search in this problem …Lets say your array of size 5 has all 1 (1,1,1,1,1) and you are asked the lower bound of 1 then in first iteration the mid will be index 2 and if will have 1 stored at index 2 so your code will give the lower bound 2 rather than 0. And similarly for upper bound it must be 4 and your code will give result as 2 .Please correct it
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.