Skip to content

Commit 73b84df

Browse files
committed
154. Find Minimum in Rotated Sorted Array II
1 parent 0251614 commit 73b84df

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/
2+
3+
class Solution {
4+
public:
5+
int findMin(vector<int>& nums) {
6+
int i=1;
7+
while(i<nums.size() && nums[i]>=nums[i-1]) i++;
8+
if(i<=nums.size()-1) return nums[i];
9+
return nums[0];
10+
}
11+
};

0 commit comments

Comments
 (0)