class Solution {
public int searchInsert(int[] nums, int target) {
int len=nums.length;
int l=0,r=len-1,ans=len;
while(l<=r){
int mid = (r+l)/2;
if(nums[mid]>=target){
ans=mid;
r=mid-1;
}else{
l=mid+1;
}
}
return ans;
}
}