Search Insert Position

int searchInsert(int* nums, int numsSize, int target) {
    int low=0;
    if(numsSize<=0)return 0;
    int high=numsSize-1;
    int mid;
    while(low<=high){
        mid=(low+high)/2;
        if(nums[mid]>=target)high=mid-1;
        else low=mid+1;
    }
    return low;
}
View Code
原文地址:https://www.cnblogs.com/lichao-normal/p/6151449.html