---
# System prepended metadata

title: 0153. Find Minimum in Rotated Sorted Array
tags: [Leetcode, Binary Search, Medium]

---

# 0153. Find Minimum in Rotated Sorted Array
###### tags: `Leetcode` `Medium` `Binary Search`
Link: https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/
## 思路
binary search
判断和第一个元素的大小关系
找到第一个比start小的元素
**注意binary search都是找第一个不符合 使得left = mid+1的条件 的元素**
如果没有，那么left = right = nums.length，这时要让left=0

## Code
```java=
class Solution {
    public int findMin(int[] nums) {
        if(nums.length==1) return nums[0];
        int start=1, end=nums.length-1;
        while(start<end){
            int mid = start+(end-start)/2;
            if(nums[0]<nums[mid]){
                start = mid+1;
            }
            else{
                end = mid;
            }
        }
        return Math.min(nums[start], nums[0]);
    }
}
```