334.Increasing Triplet Subsequence
My code
1
2
3
4
5
6
7
8
9
10
11
12
13
class Solution:
def increasingTriplet(self, nums: List[int]) -> bool:
first = second = math.inf
for n in nums:
if n <= first:
first = n
elif n <= second:
second = n
else:
return True
return False