摘要:
300.最长递增子序列 class Solution: def lengthOfLIS(self, nums: List[int]) -> int: if len(nums) <= 1: return len(nums) # dp 数组代表以下标 i 结尾包含 nums[i] 的最长递增子序列长度为 阅读全文
摘要:
309.最佳买卖股票时机含冷冻期 class Solution: def maxProfit(self, prices: List[int]) -> int: # dp[i][0] 持有股票 # dp[i][1] 卖出股票那一天 # dp[i][2] 冷冻期 # dp[i][3] 保持卖出股票的状态 阅读全文