I think this is a tricky language. The array having an infinite length means we do not know the size of the array. So we need to find the range first where this number will fall in. The very obvious approach is to take 1st element as low and 2nd element as high. If the number is >= high, shift low = high and high = 2 * previous position in the array and apply the binary search. The time complexity should be [O(Log(n)^2].