C++ 8ms recursive solution

  • 0
    int findMin(vector<int>& nums) {
        return findm(nums, 0, nums.size()-1);
    int findm(vector<int>& nums, int low, int high){
        if( low >= high ){
            return nums[low];
        int mid = low + (high - low)/2;
        int n1 = findm(nums, low, mid);
        int n2 = findm(nums, mid+1, high);
        return n1 >= n2 ? n2: n1;  

    also, it could solve this problem

Log in to reply

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