二分搜索
public class Solution {
public int searchInsert(int[] A, int target) {
int low = 0, high = A.length-1;
if(high == -1) return 0;
while(low <= high){
int mid = low + ((high - low)>>1);
if(A[mid] == target) return mid;
if(A[mid] > target) high = mid - 1;
else low = mid + 1;
}
return low;
}
}