Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int binarySearch_RightEuqalOrLarger (int[] nums, int target){
- int low = 0;
- int high = nums.length;
- while (low < high){
- int mid = low + (high - low) / 2;
- if (nums[mid] >= target) high = mid;
- else low = mid + 1;
- }
- System.out.println("target = " + target + ", found = " + nums[high] + ", index = " + high);
- return high;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement