Java Solution


  • 0
    S
    class Solution {
        public boolean increasingTriplet(int[] nums) {
            int a = Integer.MAX_VALUE;
            int b = Integer.MAX_VALUE;
            int c;
            
            for (int i = 0; i < nums.length; i++) {
            	c = nums[i];
            	if (a >= c) {
            	        a = c;
            	} else if ( b >= c) {
            		b = c;        		
            	} else {
            		return true;
            	}
            }
            return false;
        }
    }
    

Log in to reply
 

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