Really simple java solution Accepted 288ms


  • -2
    S
    public class Solution {
    public int findMin(int[] nums) {
        int i;
        int n = nums.length;
        for(i = 1; i < n; i ++) {
            if(nums[i] < nums[i -1])
                return nums[i];
        }
        return nums[0];
    }
    

    }


  • 0
    S

    Works for Minimum in Rotated Sorted Array II


Log in to reply
 

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