334. Increasing Triplet Subsequence
这题是判断数组中是否存在三个递增的数。代码如下:
1 class Solution {
2 public boolean increasingTriplet(int[] nums) {
3 int max = Integer.MAX_VALUE, min = Integer.MAX_VALUE;
4
5 for(int num : nums){
6 if(num <= min) min = num;
7 else if(num <= max) max = num;
8 else return true;
9 }
10
11 return false;
12 }
13 }
END