public class Solution {
public boolean increasingTriplet(int[] nums) {
int first = Integer.MAX_VALUE;
int second = Integer.MAX_VALUE;
for (int i = 0; i < nums.length; i++) {
if (first >= nums[i]) {
first = nums[i];
continue;
} else if (second >= nums[i]) {
second = nums[i];
continue;
} else {
return true;
}
}
return false;
}
}
没有评论:
发表评论