Easy Java Solution


  • 0
    T
    public boolean increasingTriplet(int[] nums) {
        if(nums.length<3) return false;
        int a=nums[0], b=Integer.MAX_VALUE;
        for(int num:nums){
            if(num>a&&num<b){
                b=num;
            }
            if(num>b) return true;
            if(num<a) a=num;
        }
        return false;
    }
    

    This should be in EASY category.


Log in to reply
 

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