My simple solution in Java, 211 ms


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

    Exact same solution worked for Find Minimum in Rotated Array I


Log in to reply
 

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