class Solution { public: int searchInsert(vector<int>& nums, int target) { if(nums.size()==1&&nums[0]<target) return 1; int high=nums.size()-1,low=0,mid; while(low<high) { mid=(low+high)/2; if(nums[mid]<target) low=mid+1; else high=mid; } if(nums[low]<target) return low+1; else return low; } };