class Solution(object):
def increasingTriplet(self, nums):
"""
每次记录最小的两个值,如果新的num比这两个最小值都要大,那么满足
"""
small1, small2 = float("inf"), float("inf")
for num in nums:
if num <= small1:
small1 = num
elif num <= small2:
small2 = num
else:
return True
return False
相关文章
- 03-12LintCode-Longest Increasing Subsequence
- 03-12334. Increasing Triplet Subsequence(也可以使用dp动态规划)
- 03-12LC.334. Increasing Triplet Subsequence
- 03-12【LeetCode】Increasing Triplet Subsequence(334)
- 03-12【LeetCode】334. Increasing Triplet Subsequence 解题报告(Python)
- 03-12334. Increasing Triplet Subsequence(也可以使用dp动态规划)
- 03-12【leetcode】Increasing Triplet Subsequence
- 03-12334. Increasing Triplet Subsequence
- 03-12[CF568E] Longest Increasing Subsequence
- 03-12About LIS(Longest Increasing Subsequence)