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