题目:
题解:
class Solution:def lengthOfLIS(self, nums: List[int]) -> int:d = []for n in nums:if not d or n > d[-1]:d.append(n)else:l, r = 0, len(d) - 1loc = rwhile l <= r:mid = (l + r) // 2if d[mid] >= n:loc = midr = mid - 1else:l = mid + 1d[loc] = nreturn len(d)