Javascript solution


  • 0
    J
    var increasingTriplet = function(nums) {
        if(nums===null||nums.length<3) return false;
        var small=nums[0],mid=Infinity;
        for(i=1;i<nums.length;i++){
            if(nums[i]>small&&nums[i]<mid)   mid=nums[i];
            if(nums[i]<small)   small=nums[i]
            if(nums[i]>mid)   return true;
        }
        return false;
    };

Log in to reply
 

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