334. Increasing Triplet Subsequence

Posted sysu_kww

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

以上是关于334. Increasing Triplet Subsequence的主要内容,如果未能解决你的问题,请参考以下文章

LeetCode 334. Increasing Triplet Subsequence

334. Increasing Triplet Subsequence

334. Increasing Triplet Subsequence

LeetCode-334. Increasing Triplet Subsequence

334. Increasing Triplet Subsequence

334. Increasing Triplet Subsequence