A small 4 ms C solution: I just pasted my solution to "Find Minimum in Rotated Sorted Array I"


  • -3
    G
    int findMin(int* nums, int numsSize) {
        if (numsSize == 1 || nums[0] < nums[numsSize-1]) {
            return nums[0];
        }
        for (int i = numsSize - 1; i > 0; i--) {
            if (nums[i] < nums[i-1]) {
                return nums[i];
            }
        }
    }

Log in to reply
 

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