> For the complete documentation index, see [llms.txt](https://r24zeng.gitbook.io/leetcode-notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://r24zeng.gitbook.io/leetcode-notebook/wan-quan-an-zhao-jiu-zhang-suan-fa-shua-de-60-dao-zuo-you/binary-search/154.-find-minimum-in-rotated-sorted-array-ii.md).

# 154. Find Minimum in Rotated Sorted Array II

\# Hard

{% hint style="success" %}
Same as #81.
{% endhint %}

### Solution 1:

1. consider the edge case: 1 element
2. skip repeated element at the beginning and end
3. find the pivot
4. get result under 2 situations

### Solution 2:

1. remove same element from end
2. find the pivot

```java
// Java O(logN) solusion
class Solution {
    public int findMin(int[] nums) {
        int start = 0, end = nums.length - 1;
        while(end > 0) {
            if(nums[end] != nums[start])
                break;
            end --;
        }
        
        while(start < end) {
            int mid = start + (end - start)/2;
            if(nums[mid] > nums[end])
                start = mid + 1;
            else
                end = mid;
        }
        
        return nums[start];
    }
}
```
