摘要: 300.最长递增子序列 class Solution: def lengthOfLIS(self, nums: List[int]) -> int: if len(nums) <= 1: return len(nums) # dp 数组代表以下标 i 结尾包含 nums[i] 的最长递增子序列长度为 阅读全文
posted @ 2023-12-01 16:42 忆象峰飞 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 309.最佳买卖股票时机含冷冻期 class Solution: def maxProfit(self, prices: List[int]) -> int: # dp[i][0] 持有股票 # dp[i][1] 卖出股票那一天 # dp[i][2] 冷冻期 # dp[i][3] 保持卖出股票的状态 阅读全文
posted @ 2023-12-01 15:21 忆象峰飞 阅读(5) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示