My simple c++ solution


  • 0
    K
    class Solution {
    public:
    int findMin(vector<int>& nums) {
        int l=0, r=nums.size()-1;
        while(nums[l]>nums[r])
        {
            int m=(r+l)/2;
            if(nums[m]>nums[r])l=m+1;
            else r=m;
        }
        return nums[l];
        
       }
    };

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.