![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
子序列
枫流仁武
这个作者很懒,什么都没留下…
展开
-
LeetCode 673 最长递增子序列的个数
简单动态规划 from typing import * class Solution: def findNumberOfLIS(self, nums: List[int]) -> int: if not nums: return 0 dp=[1]*len(nums) cnts=[1]*len(nums) for i in range(1,len(nums)): for j in原创 2020-06-26 11:24:07 · 127 阅读 · 0 评论 -
LeetCode 300 最长上升子序列
给定一个整数数组,找到最长上升子序列的长度。 利用二分法,思路见官方题解。 from typing import * class Solution: def lengthOfLIS(self, nums: List[int]) -> int: dp=[] for val in nums: if not dp or dp[-1]<val: dp.append(val) el原创 2020-06-15 11:16:14 · 73 阅读 · 0 评论