Skip to content

Instantly share code, notes, and snippets.

@wushbin
Created February 23, 2020 22:14
Show Gist options
  • Select an option

  • Save wushbin/b06d524ff7ec6988bad34bcf6d4f401f to your computer and use it in GitHub Desktop.

Select an option

Save wushbin/b06d524ff7ec6988bad34bcf6d4f401f to your computer and use it in GitHub Desktop.
class Solution {
public int findMin(int[] nums) {
int l = 0;
int r = nums.length - 1;
while(l < r) {
int mid = l + (r - l) / 2;
if (nums[mid] > nums[r]) {
l = mid + 1;
} else {
r = mid;
}
}
return nums[l];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment