Search in a Big Sorted Array
ID: 447; medium; 在大数组中查找
Last updated
ID: 447; medium; 在大数组中查找
Last updated
We do not know the upper bound of the range, so we double right
starting from 1 until the element at right is larger than the target
. Thus, we have a valid range containing a target
.
We cannot return mid
immediately if we found a target
because the problem requires the first position of the target
.