> For the complete documentation index, see [llms.txt](https://anand-aryan.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://anand-aryan.gitbook.io/leetcode/153.-find-minimum-in-rotated-sorted-array.md).

# 153. Find Minimum in Rotated Sorted Array

Find Minimum in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.

(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).

Find the minimum element.

You may assume no duplicate exists in the array.

## Solution <a href="#solution" id="solution"></a>

```java
public class Solution {
       public int findMin(int[] nums) {
        int start = 0;
        int end = nums.length - 1;

        while (start + 1 < end) {
            int middle = start + (end - start) / 2;
            if (nums[middle] >= nums[end]) {
                start = middle;
            } else {
                end = middle;
            }
        }

        if (nums[start] <= nums[end]) {
            return nums[start];
        } else {
            return nums[end];
        }
    }
}
```
