逐个遍历,找到满足大于第一第二的值。否则判断替换
空间复杂度较高
class Solution: def increasingTriplet(self, nums: List[int]) -> bool: if len(nums)<3: return False mini = 2 ** 31 - 1 mid = 2 ** 31 -1 for i in nums: if i <= mini: mini = i elif i <= mid and i > mini: mid = i else: return True return False