Skip to content

Commit

Permalink
Time: 4 ms (70.67%), Space: 10.2 MB (71.72%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
IC1101Virgo committed Jul 6, 2022
1 parent a80ba75 commit 338a59f
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Solution {
public:
int findMin(vector<int>& nums) {
int n=nums.size();

int lo=0, hi=n-1;

while(lo<hi){
int mid=lo+(hi-lo)/2;

if(nums[mid]>nums[hi])
lo=mid+1;

else hi=mid;
}

return nums[hi];
}
};

0 comments on commit 338a59f

Please sign in to comment.