
必须使用logn复杂度那么显然二分法了
class Solution {public int searchInsert(int[] nums, int target) {int low=0,high=nums.length;while(low<high){int mid=(low+high)/2;if(nums[mid]==target){return mid;}else if(nums[mid]<target){++low;}else{--high;}}return high;}}
震惊一次过…看来上学期数据结构还是学了的…
溜了溜了
