摘要: ##题目链接 https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/ ##题解 ###思路 对比leetcode121,转化为最大子串和问题 题目要求能卖多次,并且要让盈利最大。令其每天都买入卖出,记录其盈利情况。得到 阅读全文
posted @ 2021-01-10 10:29 deepwzh 阅读(56) 评论(0) 推荐(0) 编辑
摘要: ##题目链接 https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/ ##题解 ###思路 转化为最大连续子串和问题 题目要求只能卖一次,并且要让盈利最大。可以将卖一次分解为卖多次,令其每天都买入卖出,记录其盈利情况。得到盈 阅读全文
posted @ 2021-01-10 10:24 deepwzh 阅读(61) 评论(0) 推荐(0) 编辑
摘要: ###题目链接 https://leetcode-cn.com/problems/summary-ranges/ ###代码实现 class Solution: def summaryRanges(self, nums: List[int]) -> List[str]: res = [] if no 阅读全文
posted @ 2021-01-10 09:40 deepwzh 阅读(44) 评论(0) 推荐(0) 编辑