300. Longest Increasing Subsequence
334. Increasing Triplet Subsequence
673. Number of Longest Increasing Subsequence
1626. Best Team With No Conflicts
300
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""
[4,10,4,3,8,9]
4
1
4 10
1 2
4 10 4
1 2 1 (4 <4?
1 2 1 (10 <4?
4 10 4 3
1 2 1 1 (4 <3?
1 2 1 1 (10 <3?
1 2 1 1 (4 <3?
4 10 4 3 8
1 2 1 1 2 (4 <8 更新为1+1
1 2 1 1 1 (10 <8? 更新为1
1 2 1 1 2 (4 <8 更新为1+1
1 2 1 1 2 (3 <8 更新为1+1
4 10 4 3 8 9
1 2 1 1 2 2 (4 < 9 更新为1+1
1 2 1 1 1 1 (10 < 9? 更新为1
1 2 1 1 2 2 (4 < 9 更新为1+1
1 2 1 1 2 2 (3 < 9 更新为1+1
1 2 1 1 2 3 (8 < 9 更新为2+1
[1,3,6,7,9,4,10,5,6]
1 2 3 4 5 3 6 4 5
1 2 3 4 5 3 4
"""
res = 0
n = len(nums)
if not n: return 0
dp = [1 for _ in range(n)]
for i in range(n):
for j in range(i):
if nums[j] < nums