class Solution(object):
def increasingTriplet(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
a,b,min=float("inf"),float("inf"),float("inf")
for c in nums:
if min>=c:
min=c
elif b>=c:
a,b=min,c
else:
return True
return False
334. Increasing Triplet Subsequence
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- Question Given an unsorted array return whether an increa...
- 定义 Longest increasing subsequence(lis)算法是为了找到一个数列里最长的递增子串...
- Longest Increasing Subsequence给定一个数组,找出longest increasing...
- Given an unsorted array of integers, find the length of l...
- 把LIS和LCS对应的总共四种问题总结一下。 Longest Increasing Subsequce:DP,复杂...