摘要:
**题目链接:**https://leetcode-cn.com/problems/squares-of-a-sorted-array/ 分析: 双指针。 Python class Solution: def sortedSquares(self, A: List[int]) -> List[int 阅读全文
摘要:
**题目链接:**https://leetcode-cn.com/problems/strong-password-checker/ 分析: 是一道数学题。 连续字符串删除和插入的方式代价高,尽量使用替换。如何理解呢?对于任意>=3的连续串长度为s,所需要的替换次数为s//3, 而使用插入(s-1) 阅读全文
摘要:
**题目链接:**https://leetcode-cn.com/problems/coin-bonus/ 分析: 直接dfs去求和会超时。 利用线段树,进行区间求和和更新。 比较难理解的点是将团队成员id变成连续的。将求解一个子集合的和问题转为求解一个连续区间的和问题。对这个连续区间就可以二分去求 阅读全文