class Solution {
public:
int findMin(vector<int>& nums) {
int n = nums.size();
int left = 0, right = n - 1, mid;
while(left < right){
mid = (left + right) / 2;
if(nums[mid] > nums[right])
left = mid + 1;
else
right = mid;
}
return nums[left];
}
};
Accepted
150/150 cases passed (0 ms)
Your runtime beats 100 % of cpp submissions
Your memory usage beats 48.37 % of cpp submissions (9.9 MB)