Python O(nlogn) complexity, easy to understand I think and Thx to Stefan!

  • 0

    class Solution(object):
    def lengthOfLIS(self, nums):

        if not nums:
            return 0
        inc = [float('inf')]*len(nums)
        for i in nums:
        for i,v in enumerate(inc):
            if v > 2**31:
                return i
        return len(nums)


Log in to reply

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