Compact Python solution


  • 1
    K
    class Solution(object):
        def increasingTriplet(self, nums):
            m = [float('INF')] * 2
            for n in nums:
                pre_m = m[:]
                m[0] = min(pre_m[0], n)
                if n > pre_m[0]: m[1] = min(pre_m[1], n)
                if n > pre_m[1]: return True
            return False

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.