@lixiaolun@ChengZhang But if it is exceeding the integer limit it should show some kind of OutOfIndex but why is it showing the
Time Limit Exceed.
Thank You

@RainbowSecret Ha, I just found I used (start+end)/2 but didn't get overflow. Why? Because I always use uint when I know negative is not possible. This really saves me from a lot of boundary conditions. :)

Because your ( Start + end ) value can go beyond Integer.MAX_VALUE and hence giving you a negative value.
Eg : start = 1073741824 , end = 1073741827
if mid = (start + end) /2 the mid = 2147483651/2

Here the numerator is more than the integer range in java. hence making mid = -2147483644/2 = -1073741822 which is wrong

if mid = start + (end - start)/2 then
mid = 1073741824 + 1 = 1073741825

Hmm, I believe I've seen that article before, and thus also that >>> solution, so must have forgotten. I guess I *really* don't care about the issue :-)