leetcode
leetcode copied to clipboard
LeetCode Solutions: A Record of My Problem Solving Journey.( leetcode题解,记录自己的leetcode解题之路。)
https://leetcode-solution-leetcode-pp.gitbook.io/ 这里面的题目能否调整下文字自动换行, 每次看题好累, 还要手动拖滚动条, 你不觉得累吗? 说实话, 我宁愿看 leetcode 上的题目 
某种药方要求非常严格,你每天需要同时服用A、B两种药片各一颗,不能多也不能少。这种药非常贵,你不希望有任何一点的浪费。一天,你打开装药片A的药瓶,倒出一粒药片放在手心;然后打开另一个药瓶,但不小心倒出了两粒药片。现在,你手心上有一颗药片A,两颗药片B,并且你无法区别哪个是A,哪个是B。你如何才能严格遵循药方服用药片,并且不能有任何的浪费? 提示:药片可以破坏,比如二等分,三等分。。。
常见的是给你一个数组,然后给你一个指标, 让你求这个指标的总和。 比如给你一个数组, 给你一个子数组最大值的指标, 让你求所有子数组最大值的总和。 我们可以考虑数组每一项装结果的贡献, 然后将其累加即可。 题目: - https://leetcode.cn/problems/sum-of-subsequence-widths/ - https://leetcode.cn/problems/sum-of-subarray-ranges/
记录反向思考的题目。比如: [991. 坏了的计算器](https://leetcode.cn/problems/broken-calculator/) ```py class Solution: def brokenCalc(self, startValue: int, target: int) -> int: ans = 0 while startValue != target: if target < startValue: return ans + startValue -...
I'm adding the "451. Sort Characters By Frequency" Leetcode problem to the problems page (in English).