Go Here 直接上代码,关键还是python的写法太简洁了。 12345678910111213141516 import bisectclass : def lengthOfLIS(self, nums): """ :type nums: List[int] :rtype: int """ dp = [] for n in nums: pos = bisect.bisect_left(dp, n) if pos == len(dp): dp.append(n) else: dp[pos] = n return len(dp) 赞微海报分享
近期评论