share a simple C++ recursive solution

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

Log in to reply

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