leeway00 / CodingTestPractice

0 stars 0 forks source link

Increasing Triple Subsequence #8

Open leeway00 opened 2 years ago

leeway00 commented 2 years ago
    def increasingTriplet(self, nums: List[int]) -> bool:

        fst, snd = sys.maxsize, sys.maxsize        
        for i in nums:
            if i >  fst:
                if i > snd:
                    return True
                else:
                    snd = i
            else:
                fst = i
        return False