Simple generalised Python solution

  • 0
    def increasingTriplet(self, nums):
        mins = [-float('inf')] + [float('inf')]*3
        for num in nums:
            for i in range(1, 4):
                if num > mins[i-1] and num < mins[i]:
                    mins[i] = num
        return mins[3] != float('inf')

Log in to reply

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