图解算法 BinarySearch
public int search(int[] nums, int target) { int L = 0, R = nums.length-1; while(L < R){ int mid = L+((R-L)>>1); if(nums[mid] == target) return mid; else if(nums[mid] > target) R = mid-1; else L = mid+1; //nums[mid] < target
原创
2022-07-23 21:31:48 ·
99 阅读 ·
0 评论