'''
keys: 
Solutions:
Similar: 300
T:
S:
'''
from typing import List


class Solution:
    # T: O(N), S: O(1)
    def increasingTriplet(self, nums: List[int]) -> bool:
        first_num = float("inf")
        second_num = float("inf")
        for num in nums:
            if num <= first_num:
                first_num = num
            elif num <= second_num: # num already larger than first_num
                second_num = num
            else: # found the 3rd number larger than first_num and second_num
                return True
        return False