class Solution {
public boolean increasingTriplet(int[] nums) {
int min = nums[0];
int secondMin = Integer.MAX_VALUE;
for (int i = 1; i < nums.length; i++) {
int num = nums[i];
if (num > secondMin){
return true;
} else if (num <= min){
min = num;
} else {
secondMin = num;
}
}
return false;
}
}
递增的三元子序列
最新推荐文章于 2024-08-30 21:34:59 发布