My simple c++ solution


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

    };


Log in to reply
 

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