public static int searchInsert(int[] nums, int target) { int sta = 0,fin = nums.length,mid; while (sta < fin) { mid = (sta + fin )/2; if(nums[mid] < target) sta = mid +1; else fin = mid; } return sta; }
public static int searchInsert(int[] nums, int target) { int sta = 0,fin = nums.length,mid; while (sta < fin) { mid = (sta + fin )/2; if(nums[mid] < target) sta = mid +1; else fin = mid; } return sta; }
转载于:https://www.cnblogs.com/stAr-1/p/7112027.html