프로그래밍/LeetCode
[LeetCode][Python3] 334. Increasing Triplet Subsequence
snoopybox
2019. 3. 25. 01:04
Problem :
https://leetcode.com/problems/increasing-triplet-subsequence/
My Solution :
class Solution:
def increasingTriplet(self, nums: List[int]) -> bool:
t1 = t2 = float('INF')
for n in nums:
if n <= t1:
t1 = n
elif n <= t2:
t2 = n
else:
return True
return False