kamyu104/LeetCode-Solutions

GitHub: kamyu104/LeetCode-Solutions

涵盖 LeetCode 全部题目(3920 道)的 Python 与现代 C++ 双语题解合集,按算法分类整理并附带复杂度分析,每周持续更新。

Stars: 5310 | Forks: 1676

# [LeetCode](https://leetcode.com/problemset/all/) ![语言](https://img.shields.io/badge/language-Python%20%2F%20Modern%20C++-orange.svg)  [![许可证](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.md)  ![更新](https://img.shields.io/badge/update-weekly-green.svg)  ![进度](https://img.shields.io/badge/progress-3920%20%2F%203920-ff69b4.svg)  [![鸣谢](https://img.shields.io/badge/say-thanks-ff69f4.svg)](https://saythanks.io/to/kamyu104)  ![访客](https://visitor-badge.laobi.icu/badge?page_id=kamyu104.leetcode.solutions) * 安息吧,我的旧 Leetcode 仓库,曾拥有 `5.7k+` 的 Star 和 `2.2k+` 的 Fork(曾位列该领域前三)。 * 由于免费题目可能会被某些公司误删,现在将只发布题解。 * 每周都会新增 LeetCode 题目。我将持续更新,以提供完整的总结和更好的题解。 * 获取更多题解,可以查看我的 [LintCode](https://github.com/kamyu104/LintCode)、[GoogleKickStart](https://github.com/kamyu104/GoogleKickStart-2022)、[GoogleCodeJamIO](https://github.com/kamyu104/GoogleCodeJamIO-2022) 仓库。 * 获取更多具有挑战性的题解,还可以查看我的 [GoogleCodeJam](https://github.com/kamyu104/GoogleCodeJam-Farewell-Rounds)、[MetaHackerCup](https://github.com/kamyu104/MetaHackerCup-2025) 仓库。 * 希望你享受学习数据结构与算法的旅程。 * 注意:“🔒”表示需要订阅 [LeetCode 会员](https://leetcode.com/subscribe/)才能阅读该题目。 ## 题解 - [0001 - 1000](./0001-1000.md) - [1001 - 2000](./1001-2000.md) - [2001 - 3000](./2001-3000.md) - [3001 - 最新](./README.md) ## 算法 * [位运算](https://github.com/kamyu104/LeetCode-Solutions#bit-manipulation) * [数组](https://github.com/kamyu104/LeetCode-Solutions#array) * [字符串](https://github.com/kamyu104/LeetCode-Solutions#string) * [链表](https://github.com/kamyu104/LeetCode-Solutions#linked-list) * [栈](https://github.com/kamyu104/LeetCode-Solutions#stack) * [队列](https://github.com/kamyu104/LeetCode-Solutions#queue) * [二叉堆](https://github.com/kamyu104/LeetCode-Solutions#binary-heap) * [树](https://github.com/kamyu104/LeetCode-Solutions#tree) * [哈希表](https://github.com/kamyu104/LeetCode-Solutions#hash-table) * [数学](https://github.com/kamyu104/LeetCode-Solutions#math) * [排序](https://github.com/kamyu104/LeetCode-Solutions#sort) * [双指针](https://github.com/kamyu104/LeetCode-Solutions#two-pointers) * [递归](https://github.com/kamyu104/LeetCode-Solutions#recursion) * [二分查找](https://github.com/kamyu104/LeetCode-Solutions#binary-search) * [二叉搜索树](https://github.com/kamyu104/LeetCode-Solutions#binary-search-tree) * [广度优先搜索](https://github.com/kamyu104/LeetCode-Solutions#breadth-first-search) * [深度优先搜索](https://github.com/kamyu104/LeetCode-Solutions#depth-first-search) * [回溯](https://github.com/kamyu104/LeetCode-Solutions#backtracking) * [动态规划](https://github.com/kamyu104/LeetCode-Solutions#dynamic-programming) * [贪心](https://github.com/kamyu104/LeetCode-Solutions#greedy) * [图](https://github.com/kamyu104/LeetCode-Solutions#graph) * [几何](https://github.com/kamyu104/LeetCode-Solutions#geometry) * [模拟](https://github.com/kamyu104/LeetCode-Solutions#simulation) * [构造算法](https://github.com/kamyu104/LeetCode-Solutions#constructive-algorithms) * [设计](https://github.com/kamyu104/LeetCode-Solutions#design) ## JavaScript * [JS](https://github.com/kamyu104/LeetCode-Solutions#js) ## 数据库 * [SQL](https://github.com/kamyu104/LeetCode-Solutions#sql) ## Pandas * [PD](https://github.com/kamyu104/LeetCode-Solutions#pd) ## 参考 * [链接](./REFERENCE.md) ## 位运算 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3064 | [使用按位问题猜数字 I](https://leetcode.com/problems/guess-the-number-using-bitwise-questions-i/) | [C++](./C++/guess-the-number-using-bitwise-questions-i.cpp) [Python](./Python/guess-the-number-using-bitwise-questions-i.py) | _O(logn)_ | _O(1)_ | 中等 |🔒| 位运算 3094 | [使用按位问题猜数字 II](https://leetcode.com/problems/guess-the-number-using-bitwise-questions-ii/) | [C++](./C++/guess-the-number-using-bitwise-questions-ii.cpp) [Python](./Python/guess-the-number-using-bitwise-questions-ii.py) | _O(logr)_ | _O(1)_ | 中等 |🔒| 位运算 3125 | [使按位与结果为零的最大数字](https://leetcode.com/problems/maximum-number-that-makes-result-of-bitwise-and-zero/) | [C++](./C++/maximum-number-that-makes-result-of-bitwise-and-zero.cpp) [Python](./Python/maximum-number-that-makes-result-of-bitwise-and-zero.py) | _O(1)_ | _O(1)_ | 中等 |🔒| 位运算 3133 | [最小数组末尾值](https://leetcode.com/problems/minimum-array-end/) | [C++](./C++/minimum-array-end.cpp) [Python](./Python/minimum-array-end.py) | _O(logn)_ | _O(1)_ | 中等 | | 位运算 3199 | [统计具有偶数 XOR 置位位的三元组 I](https://leetcode.com/problems/count-triplets-with-even-xor-set-bits-i/) | [C++](./C++/count-triplets-with-even-xor-set-bits-i.cpp) [Python](./Python/count-triplets-with-even-xor-set-bits-i.py) | _O(nlogr)_ | _O(1)_ | 简单 | 🔒 | 暴力, 位运算, 奇偶性 3215 | [统计具有偶数 XOR 置位位的三元组 II](https://leetcode.com/problems/count-triplets-with-even-xor-set-bits-ii/) | [C++](./C++/count-triplets-with-even-xor-set-bits-ii.cpp) [Python](./Python/count-triplets-with-even-xor-set-bits-ii.py) | _O(nlogr)_ | _O(1)_ | 中等 | 🔒 | 位运算, 奇偶性 3226 | [使两个整数相等的位更改次数](https://leetcode.com/problems/number-of-bit-changes-to-make-two-integers-equal/) | [C++](./C++/number-of-bit-changes-to-make-two-integers-equal.cpp) [Python](./Python/number-of-bit-changes-to-make-two-integers-equal.py) | _O(logn)_ | _O(1)_ | 简单 | | 位运算 3289 | [Digitville 的两个隐形数字](https://leetcode.com/problems/the-two-sneaky-numbers-of-digitville/) | [C++](./C++/the-two-sneaky-numbers-of-digitville.cpp) [Python](./Python/the-two-sneaky-numbers-of-digitville.py) | _O(n)_ | _O(1)_ | 简单 | | 位运算 3304 | [在字符串游戏 I 中找到第 K 个字符](https://leetcode.com/problems/find-the-k-th-character-in-string-game-i/) | [C++](./C++/find-the-k-th-character-in-string-game-i.cpp) [Python](./Python/find-the-k-th-character-in-string-game-i.py) | _O(n)_ | _O(1)_ | 简单 | | 位掩码 3307| [在字符串游戏 II 中找到第 K 个字符](https://leetcode.com/problems/find-the-k-th-character-in-string-game-ii/) | [C++](./C++/find-the-k-th-character-in-string-game-ii.cpp) [Python](./Python/find-the-k-th-character-in-string-game-ii.py) | _O(1)_ | _O(1)_ | 困难 | | 位掩码 3314 | [构造最小按位数组 I](https://leetcode.com/problems/construct-the-minimum-bitwise-array-i/) | [C++](./C++/construct-the-minimum-bitwise-array-i.cpp) [Python](./Python/construct-the-minimum-bitwise-array-i.py) | _O(n)_ | _O(1)_ | 简单 | | 位运算 3315 | [构造最小按位数组 II](https://leetcode.com/problems/construct-the-minimum-bitwise-array-ii/) | [C++](./C++/construct-the-minimum-bitwise-array-ii.cpp) [Python](./Python/construct-the-minimum-bitwise-array-ii.py) | _O(n)_ | _O(1)_ | 中等 | | 位运算 3344 | [最大尺寸数组](https://leetcode.com/problems/maximum-sized-array/) | [C++](./C++/maximum-sized-array.cpp) [Python](./Python/maximum-sized-array.py) | 预计算: O(max_s^(1/5) * log(max_s))
运行时: O(log(max_s)) | _O(max_s^(1/5))_ | 中等 | 🔒 | 预计算, 位掩码, 组合数学, 二分查找 3370 | [所有位都为 1 的最小数字](https://leetcode.com/problems/smallest-number-with-all-set-bits/) | [C++](./C++/smallest-number-with-all-set-bits.cpp) [Python](./Python/smallest-number-with-all-set-bits.py) | _O(1)_ | _O(1)_ | 简单 | | 位运算 3566 | [将数组划分为两个乘积相等的子集](https://leetcode.com/problems/partition-array-into-two-equal-product-subsets/) | [C++](./C++/partition-array-into-two-equal-product-subsets.cpp) [Python](./Python/partition-array-into-two-equal-product-subsets.py) | _O(n * 2^n)_ | _O(1)_ | 中等 | | 位掩码 3632 | [XOR 至少为 K 的子数组](https://leetcode.com/problems/subarrays-with-xor-at-least-k/) | [C++](./C++/subarrays-with-xor-at-least-k.cpp) [Python](./Python/subarrays-with-xor-at-least-k.py) | _O(nlogr)_ | _O(t)_ | 困难 | 🔒 | 位掩码, 前缀和, 字典树 3646 | [下一个特殊回文数](https://leetcode.com/problems/next-special-palindrome-number/) | [C++](./C++/next-special-palindrome-number.cpp) [Python](./Python/next-special-palindrome-number.py) | 预计算: _O(9 * 2^9 + 16 * p + plogp)_
运行时: _O(logp)_ | _O(p)_ | 困难 | | 预计算, 位掩码, 排序, 二分查找 3702 | [具有非零按位异或的最长子序列](https://leetcode.com/problems/longest-subsequence-with-non-zero-bitwise-xor/) | [C++](./C++/longest-subsequence-with-non-zero-bitwise-xor.cpp) [Python](./Python/longest-subsequence-with-non-zero-bitwise-xor.py) | _O(n)_ | _O(1)_ | 中等 | | 位掩码 3750 | [反转二进制字符串的最小翻转次数](https://leetcode.com/problems/minimum-number-of-flips-to-reverse-binary-string/) | [C++](./C++/minimum-number-of-flips-to-reverse-binary-string.cpp) [Python](./Python/minimum-number-of-flips-to-reverse-binary-string.py) | _O(logn)_ | _O(1)_ | 简单 | | 位掩码 3766 | [使二进制回文的最少操作次数](https://leetcode.com/problems/minimum-operations-to-make-binary-palindrome/) | [C++](./C++/minimum-operations-to-make-binary-palindrome.cpp) [Python](./Python/minimum-operations-to-make-binary-palindrome.py) | 预计算: _O(sqrt(r) * logr)_
运行时: _O(r)_ | _O(r)_ | 中等 | | 预计算, 位掩码, 双指针 3769 | [按二进制反转排序整数](https://leetcode.com/problems/sort-integers-by-binary-reflection/) | [C++](./C++/sort-integers-by-binary-reflection.cpp) [Python](./Python/sort-integers-by-binary-reflection.py) | _O(nlogr + nlogn)_ | _O(n)_ | 简单 | | 排序, 位掩码 3782 | [交替删除操作后最后剩下的整数](https://leetcode.com/problems/last-remaining-integer-after-alternating-deletion-operations/) | [C++](./C++/last-remaining-integer-after-alternating-deletion-operations.cpp) [Python](./Python/last-remaining-integer-after-alternating-deletion-operations.py) | _O(1)_ | _O(1)_ | 困难 | | 位掩码, 模拟 3827 | [统计单比特整数](https://leetcode.com/problems/count-monobit-integers/) | [C++](./C++/count-monobit-integers.cpp) [Python](./Python/count-monobit-integers.py) | _O(logn)_ | _O(1)_ | 简单 | | 位掩码
⬆️ 回到顶部

## 数组 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3009 | [图表上的最大交叉数](https://leetcode.com/problems/maximum-number-of-intersections-on-the-chart/) | [C++](./C++/maximum-number-of-intersections-on-the-chart.cpp) [Python](./Python/maximum-number-of-intersections-on-the-chart.py) | _O(nlogn)_ | _O(n)_ | 困难 | 🔒 | 排序, 扫描线, 坐标压缩 3010 | [将数组划分为最小代价的子数组 I](https://leetcode.com/problems/divide-an-array-into-subarrays-with-minimum-cost-i/) | [C++](./C++/divide-an-array-into-subarrays-with-minimum-cost-i.cpp) [Python](./Python/divide-an-array-into-subarrays-with-minimum-cost-i.py) | _O(n)_ | _O(1)_ | 简单 | | 数组, 快速选择 3015 | [统计特定距离内的房屋数量 I](https://leetcode.com/problems/count-the-number-of-houses-at-a-certain-distance-i/) | [C++](./C++/count-the-number-of-houses-at-a-certain-distance-i.cpp) [Python](./Python/count-the-number-of-houses-at-a-certain-distance-i.py) | _O(n)_ | _O(n)_ | 中等 | | 数学, 前缀和, 差分数组 3017 | [统计特定距离内的房屋数量 II](https://leetcode.com/problems/count-the-number-of-houses-at-a-certain-distance-ii/) | [C++](./C++/count-the-number-of-houses-at-a-certain-distance-ii.cpp) [Python](./Python/count-the-number-of-houses-at-a-certain-distance-ii.py) | _O(n)_ | _O(1)_ | 困难 | | 数学, 前缀和, 差分数组 3026 | [最大好子数组和](https://leetcode.com/problems/maximum-good-subarray-sum/) | [C++](./C++/maximum-good-subarray-sum.cpp) [Python](./Python/maximum-good-subarray-sum.py) | _O(n)_ | _O(n)_ | 中等 | | 前缀和 3028 | [边界上的蚂蚁](https://leetcode.com/problems/ant-on-the-boundary/) | [C++](./C++/ant-on-the-boundary.cpp) [Python](./Python/ant-on-the-boundary.py) | _O(n)_ | _O(1)_ | 简单 | | 前缀和 3030 | [找到区域平均值的网格](https://leetcode.com/problems/find-the-grid-of-region-average/) | [C++](./C++/find-the-grid-of-region-average.cpp) [Python](./Python/find-the-grid-of-region-average.py) | _O(m * n)_ | _O * n)_ | 中等 | | 数组 3033 | [修改矩阵](https://leetcode.com/problems/modify-the-matrix/) | [C++](./C++/modify-the-matrix.cpp) [Python](./Python/modify-the-matrix.py) | _O(m * n)_ | _O(1)_ | 简单 | | 数组 3038 | [相同分数的最大操作次数 I](https://leetcode.com/problems/maximum-number-of-operations-with-the-same-score-i/) | [C++](./C++/maximum-number-of-operations-with-the-same-score-i.cpp) [Python](./Python/maximum-number-of-operations-with-the-same-score-i.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3065 | [超过阈值的最小操作次数 I](https://leetcode.com/problems/minimum-operations-to-exceed-threshold-value-i/) | [C++](./C++/minimum-operations-to-exceed-threshold-value-i.cpp) [Python](./Python/minimum-operations-to-exceed-threshold-value-i.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3069 | [将元素分配到两个数组 I](https://leetcode.com/problems/distribute-elements-into-two-arrays-i/) | [C++](./C++/distribute-elements-into-two-arrays-i.cpp) [Python](./Python/distribute-elements-into-two-arrays-i.py) | _O(n)_ | _O(n)_ | 简单 | | 数组 3070 | [统计左上角元素和小于 k 的子矩阵数量](https://leetcode.com/problems/count-submatrices-with-top-left-element-and-sum-less-than-k/) | [C++](./C++/count-submatrices-with-top-left-element-and-sum-less-than-k.cpp) [Python](./Python/count-submatrices-with-top-left-element-and-sum-less-than-k.py) | _O(n * m)_ | _O(1)_ | 中等 | | 数组, 前缀和 3071 | [在网格上写字母 Y 的最少操作次数](https://leetcode.com/problems/minimum-operations-to-write-the-letter-y-on-a-grid/) | [C++](./C++/minimum-operations-to-write-the-letter-y-on-a-grid.cpp) [Python](./Python/minimum-operations-to-write-the-letter-y-on-a-grid.py) | _O(n^2)_ | _O(1)_ | 中等 | | 数组 3079 | [查找加密整数的和](https://leetcode.com/problems/find-the-sum-of-encrypted-integers/) | [C++](./C++/find-the-sum-of-encrypted-integers.cpp) [Python](./Python/find-the-sum-of-encrypted-integers.py) | _O(nlogr)_ | _O(1)_ | 简单 | | 数组 3096 | [获得更多分数的最少关卡数](https://leetcode.com/problems/minimum-levels-to-gain-more-points/) | [C++](./C++/minimum-levels-to-gain-more-points.cpp) [Python](./Python/minimum-levels-to-gain-more-points.py) | _O(n)_ | _O(n)_ | 中等 | | 前缀和 3105 | [最长严格递增或严格递减子数组](https://leetcode.com/problems/longest-strictly-increasing-or-strictly-decreasing-subarray/) | [C++](./C++/longest-strictly-increasing-or-strictly-decreasing-subarray.cpp) [Python](./Python/longest-strictly-increasing-or-strictly-decreasing-subarray.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3127 | [制作一个颜色相同的正方形](https://leetcode.com/problems/make-a-square-with-the-same-color/) | [C++](./C++/make-a-square-with-the-same-color.cpp) [Python](./Python/make-a-square-with-the-same-color.py) | _O((n - w + 1)^2 * w^2)_ | _O(1)_ | 简单 | | 数组 3131 | [找出添加到数组中的整数 I](https://leetcode.com/problems/find-the-integer-added-to-array-i/) | [C++](./C++/find-the-integer-added-to-array-i.cpp) [Python](./Python/find-the-integer-added-to-array-i.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3142 | [检查网格是否满足条件](https://leetcode.com/problems/check-if-grid-satisfies-conditions/) | [C++](./C++/check-if-grid-satisfies-conditions.cpp) [Python](./Python/check-if-grid-satisfies-conditions.py) | _O(m * n)_ | _O(1)_ | 简单 | | 数组 3147 | [从神秘地牢中获取最大能量](https://leetcode.com/problems/taking-maximum-energy-from-the-mystic-dungeon/) | [C++](./C++/taking-maximum-energy-from-the-mystic-dungeon.cpp) [Python](./Python/taking-maximum-energy-from-the-mystic-dungeon.py) | _O(n)_ | _O(1)_ | 中等 | | 数组 3151 | [特殊数组 I](https://leetcode.com/problems/special-array-i/) | [C++](./C++/special-array-i.cpp) [Python](./Python/special-array-i.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3152 | [特殊数组 II](https://leetcode.com/problems/special-array-ii/) | [C++](./C++/special-array-ii.cpp) [Python](./Python/special-array-ii.py) | _O(n + q)_ | _O(n)_ | 中等 | | 前缀和 3153 | [所有数对的数字差之和](https://leetcode.com/problems/sum-of-digit-differences-of-all-pairs/) | [C++](./C++/sum-of-digit-differences-of-all-pairs.cpp) [Python](./Python/sum-of-digit-differences-of-all-pairs.py) | _O(nlogr)_ | _O(10 * logr)_ | 中等 | | 前缀和 3159 | [查找数组中元素的出现位置](https://leetcode.com/problems/find-occurrences-of-an-element-in-an-array/) | [C++](./C++/find-occurrences-of-an-element-in-an-array.cpp) [Python](./Python/find-occurrences-of-an-element-in-an-array.py) | _O(n + q)_ | _O(n)_ | 中等 | | 数组 3173 | [相邻元素的按位或](https://leetcode.com/problems/bitwise-or-of-adjacent-elements/) | [C++](./C++/bitwise-or-of-adjacent-elements.cpp) [Python](./Python/bitwise-or-of-adjacent-elements.py) | _O(n)_ | _O(1)_ | 简单 | 🔒 | 数组 3187 | [数组中的峰值](https://leetcode.com/problems/peaks-in-array/) | [C++](./C++/peaks-in-array.cpp) [Python](./Python/peaks-in-array.py) | _O(n + qlogn)_ | _O(n)_ | 困难 | | 树状数组, Fenwick Tree 3195 | [找到覆盖所有 1 的最小面积 I](https://leetcode.com/problems/find-the-minimum-area-to-cover-all-ones-i/) | [C++](./C++/find-the-minimum-area-to-cover-all-ones-i.cpp) [Python](./Python/find-the-minimum-area-to-cover-all-ones-i.py) | _O(n * m)_ | _O(1)_ | 中等 | | 数组 3224 | [使差值相等的最小数组更改次数](https://leetcode.com/problems/minimum-array-changes-to-make-differences-equal/) | [C++](./C++/minimum-array-changes-to-make-differences-equal.cpp) [Python](./Python/minimum-array-changes-to-make-differences-equal.py) | _O(n + k)_ | _O(k)_ | 中等 | | 前缀和, 差分数组 3279 | [活塞占据的最大总面积](https://leetcode.com/problems/maximum-total-area-occupied-by-pistons/) | [C++](./C++/maximum-total-area-occupied-by-pistons.cpp) [Python](./Python/maximum-total-area-occupied-by-pistons.py) | _O(h)_ | _O(h)_ | 困难 | 🔒 | 扫描线, 差分数组 3285 | [找到稳定山脉的索引](https://leetcode.com/problems/find-indices-of-stable-mountains/) | [C++](./C++/find-indices-of-stable-mountains.cpp) [Python](./Python/find-indices-of-stable-mountains.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3300 | [用数字和替换后的最小元素](https://leetcode.com/problems/minimum-element-after-replacement-with-digit-sum/) | [C++](./C++/minimum-element-after-replacement-with-digit-sum.cpp) [Python](./Python/minimum-element-after-replacement-with-digit-sum.py) | _O(nlogr)_ | _O(1)_ | 简单 | | 数组 3330 | [找到原始键入字符串 I](https://leetcode.com/problems/find-the-original-typed-string-i/) | [C++](./C++/find-the-original-typed-string-i.cpp) [Python](./Python/find-the-original-typed-string-i.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3334 | [找到数组的最大因子分数](https://leetcode.com/problems/find-the-maximum-factor-score-of-array/) | [C++](./C++/find-the-maximum-factor-score-of-array.cpp) [Python](./Python/find-the-maximum-factor-score-of-array.py) | _O(nlogr)_ | _O(n)_ | 中等 | | 前缀和 3349 | [相邻递增子数组检测 I](https://leetcode.com/problems/adjacent-increasing-subarrays-detection-i/) | [C++](./C++/adjacent-increasing-subarrays-detection-i.cpp) [Python](./Python/adjacent-increasing-subarrays-detection-i.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3350 | [相邻递增子数组检测 II](https://leetcode.com/problems/adjacent-increasing-subarrays-detection-ii/) | [C++](./C++/adjacent-increasing-subarrays-detection-ii.cpp) [Python](./Python/adjacent-increasing-subarrays-detection-ii.py) | _O(n)_ | _O(1)_ | 中等 | | 数组 3353 | [最小总操作次数](https://leetcode.com/problems/minimum-total-operations/) | [C++](./C++/minimum-total-operations.cpp) [Python](./Python/minimum-total-operations.py) | _O(n)_ | _O(1)_ | 简单 | 🔒 | 数组 3354 | [使数组元素等于零](https://leetcode.com/problems/make-array-elements-equal-to-zero/) | [C++](./C++/make-array-elements-equal-to-zero.cpp) [Python](./Python/make-array-elements-equal-to-zero.py) | _O(n)_ | _O(n)_ | 简单 | [CodeChef Starters 146 - 弹跳球](https://www.codechef.com/problems/BOUNCE_BALL) | 前缀和 3355 | [零数组变换 I](https://leetcode.com/problems/zero-array-transformation-i/) | [C++](./C++/zero-array-transformation-i.cpp) [Python](./Python/zero-array-transformation-i.py) | _O(n + q)_ | _O(n)_ | 中等 | | 扫描线 3361 | [两个字符串之间的移位距离](https://leetcode.com/problems/shift-distance-between-two-strings/) | [C++](./C++/shift-distance-between-two-strings.cpp) [Python](./Python/shift-distance-between-two-strings.py) | _O(n + 26)_ | _O(26)_ | 中等 | | 前缀和 3379 | [转换后的数组](https://leetcode.com/problems/transformed-array/) | [C++](./C++/transformed-array.cpp) [Python](./Python/transformed-array.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3380 | [带点约束的最大面积矩形 I](https://leetcode.com/problems/maximum-area-rectangle-with-point-constraints-i/) | [C++](./C++/maximum-area-rectangle-with-point-constraints-i.cpp) [Python](./Python/maximum-area-rectangle-with-point-constraints-i.py) | _O(nlogn)_ | _O(n)_ | 中等 | | 排序, 暴力, 树状数组, Fenwick Tree, 哈希表 3382 | [带点约束的最大面积矩形 II](https://leetcode.com/problems/maximum-area-rectangle-with-point-constraints-ii/) | [C++](./C++/maximum-area-rectangle-with-point-constraints-ii.cpp) [Python](./Python/maximum-area-rectangle-with-point-constraints-ii.py) | _O(nlogn)_ | _O(n)_ | 困难 | | 排序, 树状数组, Fenwick Tree, 哈希表 3386 | [按压时间最长的按钮](https://leetcode.com/problems/button-with-longest-push-time/) | [C++](./C++/button-with-longest-push-time.cpp) [Python](./Python/button-with-longest-push-time.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3392 | [统计满足条件的三元子数组](https://leetcode.com/problems/count-subarrays-of-length-three-with-a-condition/) | [C++](./C++/count-subarrays-of-length-three-with-a-condition.cpp) [Python](./Python/count-subarrays-of-length-three-with-a-condition.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3400 | [右移后最大匹配索引数](https://leetcode.com/problems/maximum-number-of-matching-indices-after-right-shifts/) | [C++](./C++/maximum-number-of-matching-indices-after-right-shifts.cpp) [Python](./Python/maximum-number-of-matching-indices-after-right-shifts.py) | _O(n^2)_ | _O(1)_ | 中等 | 🔒 | 暴力 3417 | [跳过之字形网格遍历](https://leetcode.com/problems/zigzag-grid-traversal-with-skip/) | [C++](./C++/zigzag-grid-traversal-with-skip.cpp) [Python](./Python/zigzag-grid-traversal-with-skip.py) | _O(n * m)_ | _O(1)_ | 简单 | | 数组 3423 | [循环数组中相邻元素的最大差值](https://leetcode.com/problems/zmaximum-difference-between-adjacent-elements-in-a-circular-array/) | [C++](./C++/maximum-difference-between-adjacent-elements-in-a-circular-array.cpp) [Python](./Python/maximum-difference-between-adjacent-elements-in-a-circular-array.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3427 | [可变长子数组的和](https://leetcode.com/problems/sum-of-variable-length-subarrays/) | [C++](./C++/sum-of-variable-length-subarrays.cpp) [Python](./Python/sum-of-variable-length-subarrays.py) | _O(n)_ | _O(n)_ | 简单 | | 差分数组 3432 | [统计偶数和差值的分区数](https://leetcode.com/problems/count-partitions-with-even-sum-difference/) | [C++](./C++/count-partitions-with-even-sum-difference.cpp) [Python](./Python/count-partitions-with-even-sum-difference.py) | _O(n)_ | _O(1)_ | 简单 | | 前缀和 3440 | [重新安排会议以获得最大空闲时间 II](https://leetcode.com/problems/reschedule-meetings-for-maximum-free-time-ii/) | [C++](./C++/reschedule-meetings-for-maximum-free-time-ii.cpp) [Python](./Python/reschedule-meetings-for-maximum-free-time-ii.py) | _O(n)_ | _O(1)_ | 中等 | | 数组 3446 | [按对角线排序矩阵](https://leetcode.com/problems/sort-matrix-by-diagonals/) | [C++](./C++/sort-matrix-by-diagonals.cpp) [Python](./Python/sort-matrix-by-diagonals.py) | _O(n^2 * logn)_ | _O(n^2)_ | 中等 | | 数组, 排序 3452 | [好数字的和](https://leetcode.com/problems/sum-of-good-numbers/) | [C++](./C++/sum-of-good-numbers.cpp) [Python](./Python/sum-of-good-numbers.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3467 | [按奇偶性转换数组](https://leetcode.com/problems/transform-array-by-parity/) | [C++](./C++/transform-array-by-parity.cpp) [Python](./Python/transform-array-by-parity.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3502 | [到达每个位置的最小](https://leetcode.com/problems/minimum-cost-to-reach-every-position/) | [C++](./C++/minimum-cost-to-reach-every-position.cpp) [Python](./Python/minimum-cost-to-reach-every-position.py) | _O(n)_ | _O(1)_ | 简单 | | 前缀和 3514 | [唯一异或三元组的数量 II](https://leetcode.com/problems/number-of-unique-xor-triplets-ii/) | [C++](./C++/number-of-unique-xor-triplets-ii.cpp) [Python](./Python/number-of-unique-xor-triplets-ii.py) | _O(nlogn)_ | _O(n)_ | 中等 | | `快速沃尔什-哈达玛变换`, FWHT, `快速子集变换`, FST, 哈希表 3531 | [统计被覆盖的建筑物](https://leetcode.com/problems/count-covered-buildings/) | [C++](./C++/count-covered-buildings.cpp) [Python](./Python/count-covered-buildings.py) | _O(n)_ | _O(n)_ | 中等 | | 数组 3537 | [填充一个特殊的网格](https://leetcode.com/problems/fill-a-special-grid/) | [C++](./C++/fill-a-special-grid.cpp) [Python](./Python/fill-a-special-grid.py) | _O(4^n)_ | _O(1)_ | 中等 | | 分治, 数组 3540 | [访问所有房屋的最少时间](https://leetcode.com/problems/minimum-time-to-visit-all-houses/) | [C++](./C++/minimum-time-to-visit-all-houses.cpp) [Python](./Python/minimum-time-to-visit-all-houses.py) | _O(n + q)_ | _O(n)_ | 中等 | 🔒 | 前缀和 3546 | [等和网格划分 I](https://leetcode.com/problems/equal-sum-grid-partition-i/) | [C++](./C++/equal-sum-grid-partition-i.cpp) [Python](./Python/equal-sum-grid-partition-i.py) | _O(m * n)_ | _O(1)_ | 中等 | | 数组 3548 | [等和网格划分 II](https://leetcode.com/problems/equal-sum-grid-partition-ii/) | [C++](./C++/equal-sum-grid-partition-ii.cpp) [Python](./Python/equal-sum-grid-partition-ii.py) | _O(m * n)_ | _O(m * n)_ | 困难 | | 数组, 哈希表 3549 | [两个多项式相乘](https://leetcode.com/problems/multiply-two-polynomials/) | [C++](./C++/multiply-two-polynomials.cpp) [Python](./Python/multiply-two-polynomials.py) | _O((n + m) * log(n + m))_ | _O(n + m)_ | 困难 | 🔒 | `快速傅里叶变换`, FFT 3550 | [数字和等于索引的最小下标](https://leetcode.com/problems/smallest-index-with-digit-sum-equal-to-index/) | [C++](./C++/smallest-index-with-digit-sum-equal-to-index.cpp) [Python](./Python/smallest-index-with-digit-sum-equal-to-index.py) | _O(nlogr)_ | _O(1)_ | 简单 | | 数组 3569 | [分割后最大化不同质数的计数](https://leetcode.com/problems/maximize-count-of-distinct-primes-after-splitx/) | [C++](./C++/maximize-count-of-distinct-primes-after-split.cpp) [Python](./Python/maximize-count-of-distinct-primes-after-split.py) | _O(r + nlogn + qlogn)_ | _O(r + n)_ | 中等 | | 数论, 二叉搜索树, 有序列表, 线段树 3637 | [Trionic 数组 I](https://leetcode.com/problems/trionic-array-i/) | [C++](./C++/trionic-array-i.cpp) [Python](./Python/trionic-array-i.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3643 | [垂直翻转方形子矩阵](https://leetcode.com/problems/flip-square-submatrix-vertically/) | [C++](./C++/flip-square-submatrix-vertically.cpp) [Python](./Python/flip-square-submatrix-vertically.py) | _O(k^2)_ | _O(1)_ | 简单 | | 数组 3653 | [范围乘法查询后的 XOR I](https://leetcode.com/problems/xor-after-range-multiplication-queries-i/) | [C++](./C++/xor-after-range-multiplication-queries-i.cpp) [Python](./Python/xor-after-range-multiplication-queries-i.py) | _O(qlogm + (q + n) * sqrt(n))_ | _O(n * sqrt(n))_ | 中等 || 平方分解, 差分数组, 快速幂, 模拟 3655 | [范围乘法查询后的 XOR II](https://leetcode.com/problems/xor-after-range-multiplication-queries-ii/) | [C++](./C++/xor-after-range-multiplication-queries-ii.cpp) [Python](./Python/xor-after-range-multiplication-queries-ii.py) | _O(qlogm + (q + n) * sqrt(n))_ | _O(n * sqrt(n))_ | 困难 || 平方分解, 差分数组, 快速幂 3674 | [使数组相等的最小操作次数](https://leetcode.com/problems/minimum-operations-to-equalize-array/) | [C++](./C++/minimum-operations-to-equalize-array.cpp) [Python](./Python/minimum-operations-to-equalize-array.py) | _O(n)_ | _O(1)_ | 简单 || 数组 3683 | [完成一项任务的最早时间](https://leetcode.com/problems/earliest-time-to-finish-one-task/) | [C++](./C++/earliest-time-to-finish-one-task.cpp) [Python](./Python/earliest-time-to-finish-one-task.py) | _O(n)_ | _O(1)_ | 简单 || 数组 3687 | [图书馆滞纳金计算器](https://leetcode.com/problems/library-late-fee-calculator/) | [C++](./C++/library-late-fee-calculator.cpp) [Python](./Python/library-late-fee-calculator.py) | _O(n)_ | _O(1)_ | 简单 |🔒| 数组 3688 | [数组中偶数的按位或](https://leetcode.com/problems/bitwise-or-of-even-numbers-in-an-array/) | [C++](./C++/bitwise-or-of-even-numbers-in-an-array.cpp) [Python](./Python/bitwise-or-of-even-numbers-in-an-array.py) | _O(n)_ | _O(1)_ | 简单 || 数组 3696 | [数组中不相等单词间的最大距离 I](https://leetcode.com/problems/maximum-distance-between-unequal-words-in-array-i/) | [C++](./C++/maximum-distance-between-unequal-words-in-array-i.cpp) [Python](./Python/maximum-distance-between-unequal-words-in-array-i.py) | _O(n * l)_ | _O(1)_ | 简单 |🔒| 数组 3700 | [之字形数组 II 的数量](https://leetcode.com/problems/number-of-zigzag-arrays-ii/) | [C++](./C++/number-of-zigzag-arrays-ii.cpp) [Python](./Python/number-of-zigzag-arrays-ii.py) | _O((r - l)^3 * logn)_ | _O((r - l)^2)_ | 困难 | | 矩阵快速幂 3701 | [计算交替和](https://leetcode.com/problems/compute-alternating-sum/) | [C++](./C++/compute-alternating-sum.cpp) [Python](./Python/compute-alternating-sum.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3706 | [数组中不相等单词间的最大距离 II](https://leetcode.com/problems/maximum-distance-between-unequal-words-in-array-ii/) | [C++](./C++/maximum-distance-between-unequal-words-in-array-ii.cpp) [Python](./Python/maximum-distance-between-unequal-words-in-array-ii.py) | _O(n * l)_ | _O(1)_ | 中等 |🔒| 数组 3707 | [等分数字母串](https://leetcode.com/problems/equal-score-substrings/) | [C++](./C++/equal-score-substrings.cpp) [Python](./Python/equal-score-substrings.py) | _O(n)_ | _O(1)_ | 简单 | | 数组, 前缀和 3708 | [最长斐波那契子数组](https://leetcode.com/problems/longest-fibonacci-subarray/) | [C++](./C++/longest-fibonacci-subarray.cpp) [Python](./Python/longest-fibonacci-subarray.py) | _O(n)_ | _O(1)_ | 中等 | | 数组 3719 | [最长平衡子数组 I](https://leetcode.com/problems/longest-balanced-subarray-i/) | [C++](./C++/longest-balanced-subarray-i.cpp) [Python](./Python/longest-balanced-subarray-i.py) | _O(nlogn)_ | _O(n)_ | 中等 | | 暴力, 线段树, 二分查找, 前缀和 3721 | [最长平衡子数组 II](https://leetcode.com/problems/longest-balanced-subarray-ii/) | [C++](./C++/longest-balanced-subarray-ii.cpp) [Python](./Python/longest-balanced-subarray-ii.py) | _O(nlogn)_ | _O(n)_ | 困难 | | 线段树, 二分查找, 前缀和 3736 | [使数组元素相等的最小移动次数 III](https://leetcode.com/problems/minimum-moves-to-equal-array-elements-iii/) | [C++](./C++/minimum-moves-to-equal-array-elements-iii.cpp) [Python](./Python/minimum-moves-to-equal-array-elements-iii.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3737 | [统计众数为多数元素的子数组 I](https://leetcode.com/problems/count-subarrays-with-majority-element-i/) | [C++](./C++/count-subarrays-with-majority-element-i.cpp) [Python](./Python/count-subarrays-with-majority-element-i.py) | _O(n)_ | _O(n)_ | 中等 | | 频率表, 前缀和 3738 | [替换最多一个元素后的最长非递减子数组](https://leetcode.com/problems/longest-non-decreasing-subarray-after-replacing-at-most-one-element/) | [C++](./C++/longest-non-decreasing-subarray-after-replacing-at-most-one-element.cpp) [Python](./Python/longest-non-decreasing-subarray-after-replacing-at-most-one-element.py) | _O(n)_ | _O(n)_ | 中等 | | 数组, 前缀和 3739 | [统计众数为多数元素的子数组 II](https://leetcode.com/problems/count-subarrays-with-majority-element-ii/) | [C++](./C++/count-subarrays-with-majority-element-ii.cpp) [Python](./Python/count-subarrays-with-majority-element-ii.py) | _O(n)_ | _O(n)_ | 困难 | | 频率表, 前缀和 3751 | [范围内数字的总波动度 I](https://leetcode.com/problems/total-waviness-of-numbers-in-range-i/) | [C++](./C++/total-waviness-of-numbers-in-range-i.cpp) [Python](./Python/total-waviness-of-numbers-in-range-i.py) | _O(nlogn)_ | _O(logn)_ | 中等 | | 暴力 3756 | [拼接非零数字并乘以和 II](https://leetcode.com/problems/concatenate-non-zero-digits-and-multiply-by-sum-ii/) | [C++](./C++/concatenate-non-zero-digits-and-multiply-by-sum-ii.cpp) [Python](./Python/concatenate-non-zero-digits-and-multiply-by-sum-ii.py) | _O(n)_ | _O(n)_ | 中等 | | 前缀和 | 3762 | [使子数组相等的最少操作次数](https://leetcode.com/problems/minimum-operations-to-equalize-subarrays/) | [C++](./C++/minimum-operations-to-equalize-subarrays.cpp) [Python](./Python/minimum-operations-to-equalize-subarrays.py) | _O((n + q) * logn)_ | _O(nlogn)_ | 困难 | | 前缀和, 坐标压缩, 可持久化线段树, 二分查找 | 3774 | [最大和最小 K 个元素的绝对差值](https://leetcode.com/problems/absolute-difference-between-maximum-and-minimum-k-elements/) | [C++](./C++/absolute-difference-between-maximum-and-minimum-k-elements.cpp) [Python](./Python/absolute-difference-between-maximum-and-minimum-k-elements.py) | _O(n)_ | _O(1)_ | 简单 | | 排序, 快速选择 3788 | [一个分割的最大分数](https://leetcode.com/problems/maximum-score-of-a-split/) | [C++](./C++/maximum-score-of-a-split.cpp) [Python](./Python/maximum-score-of-a-split.py) | _O(n)_ | _O(1)_ | 中等 | | 前缀和 3809 | [最佳可达塔](https://leetcode.com/problems/best-reachable-tower/) | [C++](./C++/best-reachable-tower.cpp) [Python](./Python/best-reachable-tower.py) | _O(n)_ | _O(1)_ | 中等 | | 数组 3814 | [预算内的最大容量](https://leetcode.com/problems/maximum-capacity-within-budget/) | [C++](./C++/maximum-capacity-within-budget.cpp) [Python](./Python/maximum-capacity-within-budget.py) | _O(n + b)_ | _O(b)_ | 中等 | | 哈希表, 前缀和, 排序, 单调栈, 二分查找 3818 | [使数组严格递增的最小前缀删除次数](https://leetcode.com/problems/minimum-prefix-removal-to-make-array-strictly-increasing/) | [C++](./C++/minimum-prefix-removal-to-make-array-strictly-increasing.cpp) [Python](./Python/minimum-prefix-removal-to-make-array-strictly-increasing.py) | _O(n)_ | _O(1)_ | 中等 | | 数组 3819 | [旋转非负元素](https://leetcode.com/problems/rotate-non-negative-elements/) | [C++](./C++/rotate-non-negative-elements.cpp) [Python](./Python/rotate-non-negative-elements.py) | _O(n)_ | _O(n)_ | 中等 | | 数组 3833 | [统计主导索引](https://leetcode.com/problems/count-dominant-indices/) | [C++](./C++/count-dominant-indices.cpp) [Python](./Python/count-dominant-indices.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3861 | [最小容量盒子](https://leetcode.com/problems/minimum-capacity-box/) | [C++](./C++/minimum-capacity-box.cpp) [Python](./Python/minimum-capacity-box.py) | _O(n)_ | _O(1)_ | 简单 | | 数组 3862 | [找到最小的平衡索引](https://leetcode.com/problems/find-the-smallest-balanced-index/) | [C++](./C++/find-the-smallest-balanced-index.cpp) [Python](./Python/find-the-smallest-balanced-index.py) | _O(n)_ | _O(1)_ | 中等 | | 前缀和 3865 | [反转 K 个子数组](https://leetcode.com/problems/reverse-k-subarrays/) | [C++](./C++/reverse-k-subarrays.cpp) [Python](./Python/reverse-k-subarrays.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | 数组 3880 | [两个值之间的最小绝对差](https://leetcode.com/problems/minimum-absolute-difference-between-two-values/) | [C++](./C++/minimum-absolute-difference-between-two-values.cpp) [Python](./Python/minimum-absolute-difference-between-two-values.py) | _O(n)_ | _O(1)_ | 简单 | | 数组3898 | [查找每个顶点的度数](https://leetcode.com/problems/find-the-degree-of-each-vertex/) | [C++](./C++/find-the-degree-of-each-vertex.cpp) [Python](./Python/find-the-degree-of-each-vertex.py) | _O(n * m)_ | _O(1)_ | 简单 | | 数组 3903 | [最小稳定索引 I](https://leetcode.com/problems/smallest-stable-index-i/) | [C++](./C++/smallest-stable-index-i.cpp) [Python](./Python/smallest-stable-index-i.py) | _O(n)_ | _O(n)_ | 简单 | | 前缀和 3904 | [最小稳定索引 II](https://leetcode.com/problems/smallest-stable-index-ii/) | [C++](./C++/smallest-stable-index-ii.cpp) [Python](./Python/smallest-stable-index-ii.py) | _O(n)_ | _O(n)_ | 中等 | | 前缀和 3907 | [统计具有相反奇偶性的较小元素](https://leetcode.com/problems/count-smaller-elements-with-opposite-parity/) | [C++](./C++/count-smaller-elements-with-opposite-parity.cpp) [Python](./Python/count-smaller-elements-with-opposite-parity.py) | _O(nlogn)_ | _O(n)_ | 中等 | 🔒 | 排序, 坐标压缩, 树状数组, Fenwick Tree 3909 | [比较双调部分的和](https://leetcode.com/problems/compare-sums-of-bitonic-parts/) | [C++](./C++/compare-sums-of-bitonic-parts.cpp) [Python](./Python/compare-sums-of-bitonic-parts.py) | _O(n)_ | _O(1)_ | 中等 | | 数组 3912 | [数组中的有效元素](https://leetcode.com/problems/valid-elements-in-an-array/) | [C++](./C++/valid-elements-in-an-array.cpp) [Python](./Python/valid-elements-in-an-array.py) | _O(n)_ | _O(n)_ | 中等 | | 前缀和 3915 | [距离至少为 K 的交替子序列的最大和](https://leetcode.com/problems/minimum-operations-to-make-array-non-decreasing/) | [C++](./C++/minimum-operations-to-make-array-non-decreasing.cpp) [Python](./Python/minimum-operations-to-make-array-non-decreasing.py) | _O(nlogn)_ | _O(n)_ | 困难 | | 排序, 坐标压缩, 树状数组, Fenwick Tree, 滑动窗口, 动态规划 3918 | [数字与其反转之间的素数之和](https://leetcode.com/problems/sum-of-primes-between-number-and-its-reverse/) | [C++](./C++/sum-of-primes-between-number-and-its-reverse.cpp) [Python](./Python/sum-of-primes-between-number-and-its-reverse.py) | 预计算: _O(r)_
运行时: _O(1)_ | _O(r)_ | 中等 | | 数论, `线性埃拉托色尼筛法`, 前缀和
⬆️ 回到顶部

## 字符串 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3019 | [按键变更次数](https://leetcode.com/problems/number-of-changing-keys/)| [C++](./C++/number-of-changing-keys.cpp) [Python](./Python/number-of-changing-keys.py)| _O(n)_ | _O(1)_ | 简单 | | 字符串 | 3023 | [在无限流中查找模式 I](https://leetcode.com/problems/find-pattern-in-infinite-stream-i/)| [C++](./C++/find-pattern-in-infinite-stream-i.cpp) [Python](./Python/find-pattern-in-infinite-stream-i.py)| _O(p + n)_ | _O(p)_ | 中等 | 🔒 | 字符串, `KMP 算法` | 3029 | [将单词恢复为初始状态的最短时间 I](https://leetcode.com/problems/minimum-time-to-revert-word-to-initial-state-i/)| [C++](./C++/minimum-time-to-revert-word-to-initial-state-i.cpp) [Python](./Python/minimum-time-to-revert-word-to-initial-state-i.py)| _O(n)_ | _O(n)_ | 中等 | | 字符串, `Z 函数`, 暴力 | 3031 | [将单词恢复为初始状态的最短时间 II](https://leetcode.com/problems/minimum-time-to-revert-word-to-initial-state-ii/)| [C++](./C++/minimum-time-to-revert-word-to-initial-state-ii.cpp) [Python](./Python/minimum-time-to-revert-word-to-initial-state-ii.py)| _O(n)_ | _O(n)_ | 困难 | | 字符串, `Z 函数` | 3034 | [匹配模式的子数组数量 I](https://leetcode.com/problems/number-of-subarrays-that-match-a-pattern-i/)| [C++](./C++/number-of-subarrays-that-match-a-pattern-i.cpp) [Python](./Python/number-of-subarrays-that-match-a-pattern-i.py)| _O(n)_ | _O(m)_ | 中等 | | 暴力, 字符串, `KMP 算法` | 3036 | [匹配模式的子数组数量 II](https://leetcode.com/problems/number-of-subarrays-that-match-a-pattern-ii/)| [C++](./C++/number-of-subarrays-that-match-a-pattern-ii.cpp) [Python](./Python/number-of-subarrays-that-match-a-pattern-ii.py)| _O(n)_ | _O(m)_ | 困难 | | 字符串, `KMP 算法` | 3037 | [在无限流中查找模式 II](https://leetcode.com/problems/find-pattern-in-infinite-stream-ii/)| [C++](./C++/find-pattern-in-infinite-stream-ii.cpp) [Python](./Python/find-pattern-in-infinite-stream-ii.py)| _O(p + n)_ | _O(p)_ | 困难 | 🔒 | 字符串, `KMP 算法` | 3042 | [统计前缀和后缀对 I](https://leetcode.com/problems/count-prefix-and-suffix-pairs-i/)| [C++](./C++/count-prefix-and-suffix-pairs-i.cpp) [Python](./Python/count-prefix-and-suffix-pairs-i.py)| _O(n * l)_ | _O(t)_ | 简单 | | 字典树, 暴力 | 3043 | [查找最长公共前缀的长度](https://leetcode.com/problems/find-the-length-of-the-longest-common-prefix/)| [C++](./C++/find-the-length-of-the-longest-common-prefix.cpp) [Python](./Python/find-the-length-of-the-longest-common-prefix.py)| _O((n + m) * l)_ | _O(t)_ | 中等 | | 字典树, 哈希表 | 3045 | [统计前缀和后缀对 II](https://leetcode.com/problems/count-prefix-and-suffix-pairs-ii/)| [C++](./C++/count-prefix-and-suffix-pairs-ii.cpp) [Python](./Python/count-prefix-and-suffix-pairs-ii.py)| _O(n * l)_ | _O(t)_ | 困难 | | 字典树 | 3076 | [数组中最短的非公共子串](https://leetcode.com/problems/shortest-uncommon-substring-in-an-array/)| [C++](./C++/shortest-uncommon-substring-in-an-array.cpp) [Python](./Python/shortest-uncommon-substring-in-an-array.py)| _O(n * l^2)_ | _O(t)_ | 中等 | | 字典树 | 3093 | [最长公共后缀查询](https://leetcode.com/problems/longest-common-suffix-queries/)| [C++](./C++/longest-common-suffix-queries.cpp) [Python](./Python/longest-common-suffix-queries.py)| _O((n + q) * l)_ | _O(t)_ | 困难 | | 字典树 | 3110 | [字符串的分数](https://leetcode.com/problems/score-of-a-string/)| [C++](./C++/score-of-a-string.cpp) [Python](./Python/score-of-a-string.py)| _O(n)_ | _O(1)_ | 简单 | | 字符串 | 3136 | [有效单词](https://leetcode.com/problems/valid-word/) | [C++](./C++/valid-word.cpp) [Python](./Python/valid-word.py) | _O(n)_ | _O(1)_ | 简单 | | 字符串 3163 | [字符串压缩 III](https://leetcode.com/problems/string-compression-iii/) | [C++](./C++/string-compression-iii.cpp) [Python](./Python/string-compression-iii.py) | _O(n)_ | _O(1)_ | 中等 | | 字符串 3210 | [找出加密后的字符串](https://leetcode.com/problems/find-the-encrypted-string/) | [C++](./C++/find-the-encrypted-string.cpp) [Python](./Python/find-the-encrypted-string.py) | _O(n)_ | _O(1)_ | 中等 | | 字符串 3271 | [哈希除法字符串](https://leetcode.com/problems/hash-divided-string/) | [C++](./C++/hash-divided-string.cpp) [Python](./Python/hash-divided-string.py) | _O(n)_ | _O(1)_ | 中等 | | 字符串 3280 | [将日期转换为二进制表示](https://leetcode.com/problems/convert-date-to-binary/) | [C++](./C++/convert-date-to-binary.cpp) [Python](./Python/convert-date-to-binary.py) | _O(1)_ | _O(1)_ | 简单 | | 字符串 3303 | [查找第一个几乎相等子串的出现位置](https://leetcode.com/problems/find-the-occurrence-of-first-almost-equal-substring/) | [C++](./C++/find-the-occurrence-of-first-almost-equal-substring.cpp) [Python](./Python/find-the-occurrence-of-first-almost-equal-substring.py) | _O(n + m)_ | _O(n + m)_ | 困难 | | `Z 函数` 3324 | [查找屏幕上出现的字符串序列](https://leetcode.com/problems/find-the-sequence-of-strings-appeared-on-the-screen/) | [C++](./C++/find-the-sequence-of-strings-appeared-on-the-screen.cpp) [Python](./Python/find-the-sequence-of-strings-appeared-on-the-screen.py) | _O(n^2)_ | _O(1)_ | 中等 | | 字符串 3340 | [检查平衡字符串](https://leetcode.com/problems/check-balanced-string/) | [C++](./C++/check-balanced-string.cpp) [Python](./Python/check-balanced-string.py) | _O(n)_ | _O(1)_ | 简单 | | 字符串 3407 | [子串匹配模式](https://leetcode.com/problems/substring-matching-pattern/) | [C++](./C++/substring-matching-pattern.cpp) [Python](./Python/substring-matching-pattern.py) | _O(n + m)_ | _O(m)_ | 简单 | | 字符串, `KMP 算法` 3455 | [最短匹配子串](https://leetcode.com/problems/shortest-matching-substring/) | [C++](./C++/shortest-matching-substring.cpp) [Python](./Python/shortest-matching-substring.py) | _O(n + m)_ | _O(n + m)_ | 困难 | | 字符串, `KMP 算法`, 双指针 3456 | [找到长度为 K 的特殊子串](https://leetcode.com/problems/find-special-substring-of-length-k/) | [C++](./C++/find-special-substring-of-length-k.cpp) [Python](./Python/find-special-substring-of-length-k.py) | _O(n)_ | _O(1)_ | 简单 | | 字符串 3491 | [电话号码前缀](https://leetcode.com/problems/phone-number-prefix/) | [C++](./C++/phone-number-prefix.cpp) [Python](./Python/phone-number-prefix.py) | _O(l * nlogn)_ | _O(1)_ | 简单 | 🔒 | 字典树, 排序 3498 | [字符串的反转度](https://leetcode.com/problems/reverse-degree-of-a-string/) | [C++](./C++/reverse-degree-of-a-string.cpp) [Python](./Python/reverse-degree-of-a-string.py) | _O(n)_ | _O(1)_ | 简单 | | 字符串 3529 | [统计水平和垂直重叠子串中的单元格数](https://leetcode.com/problems/count-cells-in-overlapping-horizontal-and-vertical-substrings/) | [C++](./C++/count-cells-in-overlapping-horizontal-and-vertical-substrings.cpp) [Python](./Python/count-cells-in-overlapping-horizontal-and-vertical-substrings.py) | _O(n * m)_ | _O(n * m)_ | 中等 | | `Z 函数` 3571 | [找到最短超级字符串 II](https://leetcode.com/problems/find-the-shortest-superstring-ii/) | [C++](./C++/find-the-shortest-superstring-ii.cpp) [Python](./Python/find-the-shortest-superstring-ii.py) | _O(n + m)_ | _O(n + m)_ | 简单 | 🔒 | `KMP 算法` 3582 | [为视频字幕生成标签](https://leetcode.com/problems/generate-tag-for-video-caption/) | [C++](./C++/generate-tag-for-video-caption.cpp) [Python](./Python/generate-tag-for-video-caption.py) | _O(n)_ | _O(1)_ | 简单 | | 字符串 3598 | [移除后相邻字符串之间的最长公共前缀](https://leetcode.com/problems/longest-common-prefix-between-adjacent-strings-after-removals/) | [C++](./C++/longest-common-prefix-between-adjacent-strings-after-removals.cpp) [Python](./Python/longest-common-prefix-between-adjacent-strings-after-removals.py) | _O(n * l)_ | _O(n)_ | 中等 | | LCP, 前缀和 3606 | [优惠券代码验证器](https://leetcode.com/problems/coupon-code-validator/) | [C++](./C++/coupon-code-validator.cpp) [Python](./Python/coupon-code-validator.py) | _O(l * nlogn)_ | _O(n * l)_ | 简单 | | 哈希表, 排序 3744 | [在扩展字符串中找到第 K 个字符](https://leetcode.com/problems/find-kth-character-in-expanded-string/) | [C++](./C++/find-kth-character-in-expanded-string.cpp) [Python](./Python/find-kth-character-in-expanded-string.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | 字符串 3746 | [平衡移除后的最小字符串长度](https://leetcode.com/problems/minimum-string-length-after-balanced-removals/) | [C++](./C++/minimum-string-length-after-balanced-removals.cpp) [Python](./Python/minimum-string-length-after-balanced-removals.py) | _O(n)_ | _O(1)_ | 中等 | | 字符串 3748 | [统计稳定子数组](https://leetcode.com/problems/count-stable-subarrays/) | [C++](./C++/count-stable-subarrays.cpp) [Python](./Python/count-stable-subarrays.py) | _O(n + q)_ | _O(n)_ | 困难 | | 前缀和 3758 |将数字单词转换为数字](https://leetcode.com/problems/convert-number-words-to-digits/) | [C++](./C++/convert-number-words-to-digits.cpp) [Python](./Python/convert-number-words-to-digits.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | 字符串 3775 | [反转具有相同元音计数的单词](https://leetcode.com/problems/reverse-words-with-same-vowel-count/) | [C++](./C++/reverse-words-with-same-vowel-count.cpp) [Python](./Python/reverse-words-with-same-vowel-count.py) | _O(n)_ | _O(1)_ | 中等 | | 字符串, 原地 3777 | [使交替子串的最少删除次数](https://leetcode.com/problems/minimum-deletions-to-make-alternating-substring/) | [C++](./C++/minimum-deletions-to-make-alternating-substring.cpp) [Python](./Python/minimum-deletions-to-make-alternating-substring.py) | _O((n + q) * logn)_ | _O(n)_ | 困难 | | 树状数组, Fenwick Tree 3794 | [反转字符串前缀](https://leetcode.com/problems/reverse-string-prefix/) | [C++](./C++/reverse-string-prefix.cpp) [Python](./Python/reverse-string-prefix.py) | _O(n)_ | _O(1)_ | 简单 | | 字符串 3813 | [元音-辅音分数](https://leetcode.com/problems/vowel-consonant-score/) | [C++](./C++/vowel-consonant-score.cpp) [Python](./Python/vowel-consonant-score.py) | _O(n)_ | _O(1)_ | 简单 | | 字符串 3823 | [反转字符串中的字母及特殊字符](https://leetcode.com/problems/reverse-letters-then-special-characters-in-a-string/) | [C++](./C++/reverse-letters-then-special-characters-in-a-string.cpp) [Python](./Python/reverse-letters-then-special-characters-in-a-string.py) | _O(n)_ | _O(1)_ | 简单 | | 字符串 3838 | [加权单词映射](https://leetcode.com/problems/weighted-word-mapping/) | [C++](./C++/weighted-word-mapping.cpp) [Python](./Python/weighted-word-mapping.py) | _O(n * l)_ | _O(1)_ | 简单 | | 字符串 3856 | [修剪尾随元音](https://leetcode.com/problems/trim-trailing-vowels/) | [C++](./C++/trim-trailing-vowels.cpp) [Python](./Python/trim-trailing-vowels.py) | _O(n)_ | _O(1)_ | 简单 | | 字符串 3860 | [唯一电子邮件组](https://leetcode.com/problems/unique-email-groups/) | [C++](./C++/unique-email-groups.cpp) [Python](./Python/unique-email-groups.py) | _O(n * l)_ | _O(n * l)_ | 中等 | 🔒 | 字符串, 哈希表 3884 | [两端第一个匹配的字符](https://leetcode.com/problems/first-matching-character-from-both-ends/) | [C++](./C++/first-matching-character-from-both-ends.cpp) [Python](./Python/first-matching-character-from-both-ends.py) | _O(n)_ | _O(1)_ | 中等 | | 字符串
⬆️ 回到顶部

## 链表 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3062 | [链表游戏的获胜者](https://leetcode.com/problems/winner-of-the-linked-list-game/) | [C++](./C++/winner-of-the-linked-list-game.cpp) [Python](./Python/winner-of-the-linked-list-game.py) | _O(n)_ | _O(1)_ | 简单 | 🔒 | 链表 3063 | [链表频率](https://leetcode.com/problems/linked-list-frequency/) | [C++](./C++/linked-list-frequency.cpp) [Python](./Python/linked-list-frequency.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | 链表 3217 | [从链表中删除存在于数组中的节点](https://leetcode.com/problems/delete-nodes-from-linked-list-present-in-array/) | [C++](./C++/delete-nodes-from-linked-list-present-in-array.cpp) [Python](./Python/delete-nodes-from-linked-list-present-in-array.py) | _O(n)_ | _O(m)_ | 中等 | | 哈希表, 链表 3263 | [将双向链表转换为数组 I](https://leetcode.com/problems/convert-doubly-linked-list-to-array-i/) | [C++](./C++/convert-doubly-linked-list-to-array-i.cpp) [Python](./Python/convert-doubly-linked-list-to-array-i.py) | _O(n)_ | _O(1)_ | 简单 | 🔒 | 链表 3294 | [将双向链表转换为数组 II](https://leetcode.com/problems/convert-doubly-linked-list-to-array-ii/) | [C++](./C++/convert-doubly-linked-list-to-array-ii.cpp) [Python](./Python/convert-doubly-linked-list-to-array-ii.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | 链表
⬆️ 回到顶部

## 栈 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3113 | [找到边界元素为最大值的子数组数量](https://leetcode.com/problems/find-the-number-of-subarrays-where-boundary-elements-are-maximum/) | [C++](./C++/find-the-number-of-subarrays-where-boundary-elements-are-maximum.cpp) [Python](./Python/find-the-number-of-subarrays-where-boundary-elements-are-maximum.py) | _O(n)_ | _O(n)_ | 困难 | | 单调栈, 组合数学 3174 | [清除数字](https://leetcode.com/problems/clear-digits/) | [C++](./C++/clear-digits.cpp) [Python](./Python/clear-digits.py) | _O(n)_ | _O(1)_ | 简单 | | 栈, 双指针 3676 | [统计碗形子数组](https://leetcode.com/problems/count-bowl-subarrays/) | [C++](./C++/count-bowl-subarrays.cpp) [Python](./Python/count-bowl-subarrays.py) | _O(n)_ | _O(n)_ | 中等 | | 单调栈 3703 | [移除 K 个平衡子串](https://leetcode.com/problems/remove-k-balanced-substrings/) | [C++](./C++/remove-k-balanced-substrings.cpp) [Python](./Python/remove-k-balanced-substrings.py) | _O(n)_ | _O(n)_ | 中等 | | 栈 3749 | [计算有效表达式](https://leetcode.com/problems/evaluate-valid-expressions/) | [C++](./C++/evaluate-valid-expressions.cpp) [Python](./Python/evaluate-valid-expressions.py) | _O(n)_ | _O(n)_ | 困难 | 🔒 | 栈 3834 | [合并相邻相等元素](https://leetcode.com/problems/merge-adjacent-equal-elements/) | [C++](./C++/merge-adjacent-equal-elements.cpp) [Python](./Python/merge-adjacent-equal-elements.py) | _O(n)_ | _O(1)_ | 中等 | | 栈, 模拟 3878 | [统计好子数组](https://leetcode.com/problems/count-good-subarrays/) | [C++](./C++/count-good-subarrays.cpp) [Python](./Python/count-good-subarrays.py) | _O(n)_ | _O(n)_ | 困难 | | 组合数学, 单调栈
⬆️ 回到顶部

## 队列 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----|
⬆️ 回到顶部

## 二叉堆 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3066 | [超过阈值的最小操作次数 II](https://leetcode.com/problems/minimum-operations-to-exceed-threshold-value-ii/) | [C++](./C++/minimum-operations-to-exceed-threshold-value-ii.cpp) [Python](./Python/minimum-operations-to-exceed-threshold-value-ii.py) | _O(nlogn)_ | _O(n)_ | 中等 | | 模拟, 堆 3080 | [通过执行查询标记数组中的元素](https://leetcode.com/problems/mark-elements-on-array-by-performing-queries/) | [C++](./C++/mark-elements-on-array-by-performing-queries.cpp) [Python](./Python/mark-elements-on-array-by-performing-queries.py) | _O(q + nlogn)_ | _O(n)_ | 中等 | | 哈希表, 堆 3092 | [最频繁的 ID](https://leetcode.com/problems/most-frequent-ids/) | [C++](./C++/most-frequent-ids.cpp) [Python](./Python/most-frequent-ids.py) | _O(nlogn)_ | _O(n)_ | 中等 | | 堆, 二叉搜索树, 有序列表 3256 | [放置三个车后的最大价值总和 I](https://leetcode.com/problems/maximum-value-sum-by-placing-three-rooks-i/) | [C++](./C++/maximum-value-sum-by-placing-three-rooks-i.cpp) [Python](./Python/maximum-value-sum-by-placing-three-rooks-i.py) | _O(m * n)_ | _O(m + n)_ | 困难 | | 堆, 暴力 3257 | [放置三个车后的最大价值总和 II](https://leetcode.com/problems/maximum-value-sum-by-placing-three-rooks-ii/) | [C++](./C++/maximum-value-sum-by-placing-three-rooks-ii.cpp) [Python](./Python/maximum-value-sum-by-placing-three-rooks-ii.py) | _O(m * n)_ | _O(m + n)_ | 困难 | | 堆, 暴力 3275 | [第 K 近的障碍物查询](https://leetcode.com/problems/k-th-nearest-obstacle-queries/) | [C++](./C++/k-th-nearest-obstacle-queries.cpp) [Python](./Python/k-th-nearest-obstacle-queries.py) | _O(qlogk)_ | _O(k)_ | 中等 | | 堆 3684 | [最大化最多 K 个不同元素的和](https://leetcode.com/problems/maximize-sum-of-at-most-k-distinct-elements/) | [C++](./C++/maximize-sum-of-at-most-k-distinct-elements.cpp) [Python](./Python/maximize-sum-of-at-most-k-distinct-elements.py) | _O(nlogk)_ | _O(k)_ | 简单 | | 堆, 排序 3691 | [最大子数组值总和 II](https://leetcode.com/problems/maximum-total-subarray-value-ii/) | [C++](./C++/maximum-total-subarray-value-ii.cpp) [Python](./Python/maximum-total-subarray-value-ii.py) | _O((n + k) * logn)_ | _O(n)_ | 困难 | | 堆, 排序, 双指针, RMQ, 稀疏表, 线段树 3781 | [二进制交换后的最大分数](https://leetcode.com/problems/maximum-score-after-binary-swaps/) | [C++](./C++/maximum-score-after-binary-swaps.cpp) [Python](./Python/maximum-score-after-binary-swaps.py) | _O(nlogn)_ | _O(n)_ | 中等 | | 堆
⬆️ 回到顶部

## 树 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3109 | [查找排列的索引](https://leetcode.com/problems/find-the-index-of-permutation/)| [C++](./C++/find-the-index-of-permutation.cpp) [Python](./Python/find-the-index-of-permutation.py)| _O(nlogn)_ | _O(n)_ | 🔒, 中等 | 变体自 [统计后面较小数字的个数](https://leetcode.com/problems/count-of-smaller-numbers-after-self/) | 树状数组, Fenwick Tree, 组合数学 | 3515 | [加权树中的最短路径](https://leetcode.com/problems/shortest-path-in-a-weighted-tree/)| [C++](./C++/shortest-path-in-a-weighted-tree.cpp) [Python](./Python/shortest-path-in-a-weighted-tree.py)| _O(nlogn)_ | _O(n)_ | 困难 | | 树状数组, Fenwick Tree, 深度优先搜索 | 3553 | [具有所需路径的最小加权子图 II](https://leetcode.com/problems/minimum-weighted-subgraph-with-the-required-paths-ii/)| [C++](./C++/minimum-weighted-subgraph-with-the-required-paths-ii.cpp) [Python](./Python/minimum-weighted-subgraph-with-the-required-paths-ii.py)| _O(n + q)_ | _O(n + q)_ | 困难 | | 树, 深度优先搜索, `Tarjan 离线 LCA 算法` | 3558 | [分配边权重的方法数 I](https://leetcode.com/problems/number-of-ways-to-assign-edge-weights-i/)| [C++](./C++/number-of-ways-to-assign-edge-weights-i.cpp) [Python](./Python/number-of-ways-to-assign-edge-weights-i.py)| _O(n)_ | _O(n)_ | 中等 | | 树, 广度优先搜索, 组合数学 | 3559 | [分配边权重的方法数 II](https://leetcode.com/problems/number-of-ways-to-assign-edge-weights-ii/)| [C++](./C++/number-of-ways-to-assign-edge-weights-ii.cpp) [Python](./Python/number-of-ways-to-assign-edge-weights-ii.py)| _O(n + q)_ | _O(n + q)_ | 中等 | | 树, 深度优先搜索, `Tarjan 离线 LCA 算法`, 组合数学 | 3585 | [在树中查找加权中位数节点](https://leetcode.com/problems/find-weighted-median-node-in-tree/)| [C++]() [Python](./Python/find-weighted-median-node-in-tree.py)| _O(n + qlogh)_ | _O(n + q)_ | 困难 | | 树, 深度优先搜索, `Tarjan 离线 LCA 算法`, 二分查找, 前缀和 | 3715 | [完全平方祖先之和](https://leetcode.com/problems/sum-of-perfect-square-ancestors/)| [C++](./C++/sum-of-perfect-square-ancestors.cpp) [Python](./Python/sum-of-perfect-square-ancestors.py)| 预计算: _O(r)_
运行时: _O(nlogx)_ | _O(r + n)_ | 困难 | | 树, 数论, `线性埃拉托色尼筛法`, 频率表, 深度优先搜索 | 3841 | [树中回文路径查询](https://leetcode.com/problems/palindromic-path-queries-in-a-tree/)| [C++](./C++/palindromic-path-queries-in-a-tree.cpp) [Python](./Python/palindromic-path-queries-in-a-tree.py)| _O((n + q) * logn)_ | _O(n)_ | 困难 | | 深度优先搜索, HLD, 重链剖分, 最近公共祖先, 倍增, 树状数组, Fenwick Tree | 3879 | [二叉树中的最大不同路径和](https://leetcode.com/problems/maximum-distinct-path-sum-in-a-binary-tree/)| [C++](./C++/maximum-distinct-path-sum-in-a-binary-tree.cpp) [Python](./Python/maximum-distinct-path-sum-in-a-binary-tree.py)| _O(n^2)_ | _O(n)_ | 中等 | | 深度优先搜索, 广度优先搜索
⬆️ 回到顶部

## 哈希表 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3005 | [统计具有最大频率的元素](https://leetcode.com/problems/count-elements-with-maximum-frequency/) | [C++](./C++/count-elements-with-maximum-frequency.cpp) [Python](./Python/count-elements-with-maximum-frequency.py) | _O(n)_ | _O(n)_ | 简单 || 频率表 3039 | [应用操作使字符串为空](https://leetcode.com/problems/apply-operations-to-make-string-empty/) | [C++](./C++/apply-operations-to-make-string-empty.cpp) [Python](./Python/apply-operations-to-make-string-empty.py) | _O(n)_ | _O(1)_ | 中等 || 频率表 3044 | [最频繁的素数](https://leetcode.com/problems/most-frequent-prime/) | [C++](./C++/most-frequent-prime.cpp) [Python](./Python/most-frequent-prime.py) | 预计算: _O(10^MAX_N_M)_
运行时: _O(n * m * (n + m))_ | _O(10^MAX_N_M + n * m * (n + m))_ | 中等 || 数论, `线性埃拉托色尼筛法`, 频率表 3046 | [分割数组](https://leetcode.com/problems/split-the-array/) | [C++](./C++/split-the-array.cpp) [Python](./Python/split-the-array.py) | _O(n)_ | _O(n)_ | 简单 || 频率表 3078 | [在矩阵中匹配字母数字模式 I](https://leetcode.com/problems/match-alphanumerical-pattern-in-matrix-i/) | [C++](./C++/match-alphanumerical-pattern-in-matrix-i.cpp) [Python](./Python/match-alphanumerical-pattern-in-matrix-i.py) | _O(n * m * r * c)_ | _O(1)_ | 中等 |🔒| 暴力, 哈希表 3083 | [子串及其反转在字符串中的存在性](https://leetcode.com/problems/existence-of-a-substring-in-a-string-and-its-reverse/) | [C++](./C++/existence-of-a-substring-in-a-string-and-its-reverse.cpp) [Python](./Python/existence-of-a-substring-in-a-string-and-its-reverse.py) | _O(n)_ | _O(min(n, 26^2))_ | 简单 || 哈希表 3120 | [统计特殊字符的数量 I](https://leetcode.com/problems/count-the-number-of-special-characters-i/) | [C++](./C++/count-the-number-of-special-characters-i.cpp) [Python](./Python/count-the-number-of-special-characters-i.py) | _O(n + 26)_ | _O(26)_ | 简单 || 哈希 3658 | [奇偶和的最大公约数](https://leetcode.com/problems/gcd-of-odd-and-even-sums/) | [C++](./C++/gcd-of-odd-and-even-sums.cpp) [Python](./Python/gcd-of-odd-and-even-sums.py) | _O(1)_ | _O(1)_ | 简单 | | 数学 | 3659 | [将数组划分为 K 个不同的组](https://leetcode.com/problems/partition-array-into-k-distinct-groups/) | [C++](./C++/partition-array-into-k-distinct-groups.cpp) [Python](./Python/partition-array-into-k-distinct-groups.py) | _O(n)_ | _O(n)_ | 中等 | | 数学, 频率表 | 3664 | [双字母纸牌游戏](https://leetcode.com/problems/two-letter-card-game/) | [C++](./C++/two-letter-card-game.cpp) [Python](./Python/two-letter-card-game.py) | _O(n + 26)_ | _O(26)_ | 中等 | | 数学, 频率表 | 3666 | [使二进制字符串相等的最小操作次数](https://leetcode.com/problems/minimum-operations-to-equalize-binary-string/) | [C++](./C++/minimum-operations-to-equalize-binary-string.cpp) [Python](./Python/minimum-operations-to-equalize-binary-string.py) | _O(n)_ | _O(1)_ | 困难 | | 数学 | 3671 | [优美子序列的和](https://leetcode.com/problems/sum-of-beautiful-subsequences/) | [C++](./C++/sum-of-beautiful-subsequences.cpp) [Python](./Python/sum-of-beautiful-subsequences.py) | 预计算: _O(rlogr)_
运行时: _O(nlogr * (log(nlogr) + logn))_ | _O(rlogr)_ | 困难 | | 数论, 树状数组, Fenwick Tree | 3677 | [统计二进制回文数](https://leetcode.com/problems/count-binary-palindromic-numbers/) | [C++](./C++/count-binary-palindromic-numbers.cpp) [Python](./Python/count-binary-palindromic-numbers.py) | _O(logn)_ | _O(1)_ | 困难 | | 位运算, 组合数学 | 3697 | [计算十进制表示](https://leetcode.com/problems/compute-decimal-representation/) | [C++](./C++/compute-decimal-representation.cpp) [Python](./Python/compute-decimal-representation.py) | _O(logn)_ | _O(1)_ | 简单 | | 数学 | 3726 | [移除十进制表示中的零](https://leetcode.com/problems/remove-zeros-in-decimal-representation/) | [C++](./C++/remove-zeros-in-decimal-representation.cpp) [Python](./Python/remove-zeros-in-decimal-representation.py) | _O(logn)_ | _O(1)_ | 简单 | | 数学, 字符串 | 3731 | [寻找缺失元素](https://leetcode.com/problems/find-missing-elements/) | [C++](./C++/find-missing-elements.cpp) [Python](./Python/find-missing-elements.py) | _O(n + r)_ | _O(n)_ | 简单 | | 哈希表 | 3745 | [最大化三个元素的表达式](https://leetcode.com/problems/maximize-expression-of-three-elements/) | [C++](./C++/maximize-expression-of-three-elements.cpp) [Python](./Python/maximize-expression-of-three-elements.py) | _O(n)_ | _O(1)_ | 简单 | | 数学 | 3747 | [移除零后统计不同的整数](https://leetcode.com/problems/count-distinct-integers-after-removing-zeros/) | [C++](./C++/count-distinct-integers-after-removing-zeros.cpp) [Python](./Python/count-distinct-integers-after-removing-zeros.py) | _O(logn)_ | _O(1)_ | 中等 | | 组合数学 | 3754 | [拼接非零数字并乘以和 I](https://leetcode.com/problems/concatenate-non-zero-digits-and-multiply-by-sum-i/) | [C++](./C++/concatenate-non-zero-digits-and-multiply-by-sum-i.cpp) [Python](./Python/concatenate-non-zero-digits-and-multiply-by-sum-i.py) | _O(logn)_ | _O(1)_ | 简单 | | 数学 | 3765 | [完全素数](https://leetcode.com/problems/complete-prime-number/) | [C++](./C++/complete-prime-number.cpp) [Python](./Python/complete-prime-number.py) | _O(logn * sqrt(n))_ | _O(1)_ | 中等 | | 前缀和, 数论 | 3770 | [连续素数和的最大素数](https://leetcode.com/problems/largest-prime-from-consecutive-prime-sum/) | [C++](./C++/largest-prime-from-consecutive-prime-sum.cpp) [Python](./Python/largest-prime-from-consecutive-prime-sum.py) | 预计算: _O(r)_
运行时: _O(logp)_ | _O(sqrt(r))_ | 中等 || 预计算, 数论, `Linear Sieve of Eratosthenes`, 二分查找 3783 | [整数的镜像距离](https://leetcode.com/problems/mirror-distance-of-an-integer/) | [C++](./C++/mirror-distance-of-an-integer.cpp) [Python](./Python/mirror-distance-of-an-integer.py) | _O(logn)_ | _O(1)_ | 简单 || 数学 3789 | [获取所需物品的最小成本](https://leetcode.com/problems/minimum-cost-to-acquire-required-items/) | [C++](./C++/minimum-cost-to-acquire-required-items.cpp) [Python](./Python/minimum-cost-to-acquire-required-items.py) | _O(1)_ | _O(1)_ | 中等 || 数学 3790 | [最小全 1 倍数](https://leetcode.com/problems/smallest-all-ones-multiple/) | [C++](./C++/smallest-all-ones-multiple.cpp) [Python](./Python/smallest-all-ones-multiple.py) | _O(k)_ | _O(1)_ | 中等 | [可被 K 整除的最小整数](https://leetcode.com/problems/smallest-integer-divisible-by-k/) 的重复题 | 数学 3798 | [最大偶数](https://leetcode.com/problems/largest-even-number/) | [C++](./C++/largest-even-number.cpp) [Python](./Python/largest-even-number.py) | _O(n)_ | _O(1)_ | 简单 | | 数学 3800 | [使两个二进制字符串相等的最小成本](https://leetcode.com/problems/minimum-cost-to-make-two-binary-strings-equal/) | [C++](./C++/minimum-cost-to-make-two-binary-strings-equal.cpp) [Python](./Python/minimum-cost-to-make-two-binary-strings-equal.py) | _O(n)_ | _O(1)_ | 中等 | | 数学 3817 | [数字字符串中的好下标](https://leetcode.com/problems/good-indices-in-a-digit-string/) | [C++](./C++/good-indices-in-a-digit-string.cpp) [Python](./Python/good-indices-in-a-digit-string.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | 数学, 滑动窗口 3821 | [寻找具有 K 个 1 的第 N 小整数](https://leetcode.com/problems/find-nth-smallest-integer-with-k-one-bits/) | [C++](./C++/find-nth-smallest-integer-with-k-one-bits.cpp) [Python](./Python/find-nth-smallest-integer-with-k-one-bits.py) | 构造: _O(r^2)_
运行时: _O(r)_ | _O(r^2)_ | 困难 | | 动态规划, 组合数学 3855 | [区间内 K 位数的和](https://leetcode.com/problems/sum-of-k-digit-numbers-in-a-range/) | [C++](./C++/sum-of-k-digit-numbers-in-a-range.cpp) [Python](./Python/sum-of-k-digit-numbers-in-a-range.py) | _O(logr)_ | _O(1)_ | 困难 | | 数学 3857 | [拆分为 1 的最小成本](https://leetcode.com/problems/minimum-cost-to-split-into-ones/) | [C++](./C++/minimum-cost-to-split-into-ones.cpp) [Python](./Python/minimum-cost-to-split-into-ones.py) | _O(1)_ | _O(1)_ | 中等 | | 组合数学 3870 | [统计区间内的逗号数量](https://leetcode.com/problems/count-commas-in-range/) | [C++](./C++/count-commas-in-range.cpp) [Python](./Python/count-commas-in-range.py) | _O(logn)_ | _O(1)_ | 简单 | | 数学 3871 | [统计区间内的逗号数量 II](https://leetcode.com/problems/count-commas-in-range-ii/) | [C++](./C++/count-commas-in-range-ii.cpp) [Python](./Python/count-commas-in-range-ii.py) | _O(logn)_ | _O(1)_ | 中等 | | 数学 3881 | [恰好有 K 个可见人的方向分配](https://leetcode.com/problems/direction-assignments-with-exactly-k-visible-people/) | [C++](./C++/direction-assignments-with-exactly-k-visible-people.cpp) [Python](./Python/direction-assignments-with-exactly-k-visible-people.py) | _O(n)_ | _O(n)_ | 中等 | | 组合数学 3895 | [统计数字出现次数](https://leetcode.com/problems/count-digit-appearances/) | [C++](./C++/count-digit-appearances.cpp) [Python](./Python/count-digit-appearances.py) | _O(nlogr)_ | _O(1)_ | 中等 | | 数学 3896 | [统计数字出现次数](https://leetcode.com/problems/minimum-operations-to-transform-array-into-alternating-prime/) | [C++](./C++/minimum-operations-to-transform-array-into-alternating-prime.cpp) [Python](./Python/minimum-operations-to-transform-array-into-alternating-prime.py) | 预计算: _O(r)_, 运行时: _O(nlogn)_ | _O(r)_ | 中等 | | 数论, `Linear Sieve of Eratosthenes`, 素数间距, 二分查找 3899 | [三角形的角](https://leetcode.com/problems/angles-of-a-triangle/) | [C++](./C++/angles-of-a-triangle.cpp) [Python](./Python/angles-of-a-triangle.py) | _O(1)_ | _O(1)_ | 中等 | | 数学, 余弦定理 3908 | [有效数字](https://leetcode.com/problems/valid-digit-number/) | [C++](./C++/valid-digit-number.cpp) [Python](./Python/valid-digit-number.py) | _O(logn)_ | _O(1)_ | 简单 | | 数学
⬆️ 回到顶部

## 排序 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3011 | [判断数组是否可以排序](https://leetcode.com/problems/find-if-array-can-be-sorted/) | [C++](./C++/find-if-array-can-be-sorted.cpp) [Python](./Python/find-if-array-can-be-sorted.py) | _O(n)_ | _O(1)_ | 中等 | | 排序 3025 | [将人放置在网格上的方案数 I](https://leetcode.com/problems/find-the-number-of-ways-to-place-people-i/) | [C++](./C++/find-the-number-of-ways-to-place-people-i.cpp) [Python](./Python/find-the-number-of-ways-to-place-people-i.py) | _O(n^2)_ | _O(1)_ | 中等 | | 排序, 数组 3027 | [将人放置在网格上的方案数 II](https://leetcode.com/problems/find-the-number-of-ways-to-place-people-ii/) | [C++](./C++/find-the-number-of-ways-to-place-people-ii.cpp) [Python](./Python/find-the-number-of-ways-to-place-people-ii.py) | _O(n^2)_ | _O(1)_ | 困难 | | 排序, 数组 3081 | [替换字符串中的问号以最小化其值](https://leetcode.com/problems/replace-question-marks-in-string-to-minimize-its-value/) | [C++](./C++/replace-question-marks-in-string-to-minimize-its-value.cpp) [Python](./Python/replace-question-marks-in-string-to-minimize-its-value.py) | _O(n + 26 * log(26))_ | _O(n + 26)_ | 中等 | | 贪心, 计数排序, 堆, 前缀和 3132 | [求添加到数组中的整数 II](https://leetcode.com/problems/find-the-integer-added-to-array-ii/) | [C++](./C++/find-the-integer-added-to-array-ii.cpp) [Python](./Python/find-the-integer-added-to-array-ii.py) | _O(n)_ | _O(n)_ | 中等 | | 排序, 部分排序, 频率表 3169 | [统计没有开会的日子](https://leetcode.com/problems/count-days-without-meetings/) | [C++](./C++/count-days-without-meetings.cpp) [Python](./Python/count-days-without-meetings.py) | _O(nlogn)_ | _O(1)_ | 中等 | | 排序 3194 | [最小元素和最大元素的最小平均值](https://leetcode.com/problems/minimum-average-of-smallest-and-largest-elements/) | [C++](./C++/minimum-average-of-smallest-and-largest-elements.cpp) [Python](./Python/minimum-average-of-smallest-and-largest-elements.py) | _O(nlogn)_ | _O(1)_ | 简单 | | 排序 3309 | [通过二进制拼接得到的最大可能数字](https://leetcode.com/problems/maximum-possible-number-by-binary-concatenation/) | [C++](./C++/maximum-possible-number-by-binary-concatenation.cpp) [Python](./Python/maximum-possible-number-by-binary-concatenation.py) | _O(n * logr * logn)_ | _O(nlogr)_ | 中等 | | 排序, 暴力枚举 3394 | [检查网格是否可以被切成多个部分](https://leetcode.com/problems/check-if-grid-can-be-cut-into-sections/) | [C++](./C++/check-if-grid-can-be-cut-into-sections.cpp) [Python](./Python/check-if-grid-can-be-cut-into-sections.py) | _O(nlogn)_ | _O(1)_ | 中等 | | 排序, 合并区间 3431 | [对数字进行排序的最小未锁定下标](https://leetcode.com/problems/minimum-unlocked-indices-to-sort-nums/) | [C++](./C++/minimum-unlocked-indices-to-sort-nums.cpp) [Python](./Python/minimum-unlocked-indices-to-sort-nums.py) | _O(n)_ | _O(1)_ | 中等 | | 排序 3551 | [按数字和排序的最小交换次数](https://leetcode.com/problems/minimum-swaps-to-sort-by-digit-sum/) | [C++](./C++/minimum-swaps-to-sort-by-digit-sum.cpp) [Python](./Python/minimum-swaps-to-sort-by-digit-sum.py) | _O(nlogr + nlogn)_ | _O(n)_ | 中等 | | 排序 3631 | [按严重程度和可利用性对威胁进行排序](https://leetcode.com/problems/sort-threats-by-severity-and-exploitability/) | [C++](./C++/sort-threats-by-severity-and-exploitability.cpp) [Python]() | _O(nlogn)_ | _O(1)_ | 中等 | 🔒 | 排序 3644 | [对排列进行排序的最大 K 值](https://leetcode.com/problems/maximum-k-to-sort-a-permutation/) | [C++](./C++/maximum-k-to-sort-a-permutation.cpp) [Python](./Python/maximum-k-to-sort-a-permutation.py) | _O(n)_ | _O(1)_ | 中等 | | 排序, 位运算, 构造算法 3667 | [按绝对值排序数组](https://leetcode.com/problems/sort-array-by-absolute-value/) | [C++](./C++/sort-array-by-absolute-value.cpp) [Python](./Python/sort-array-by-absolute-value.py) | _O(n + r)_ | _O(n + r)_ | 简单 | 🔒 | 排序 3759 | [统计至少有 K 个较大值的元素数量](https://leetcode.com/problems/count-elements-with-at-least-k-greater-values/) | [C++](./C++/count-elements-with-at-least-k-greater-values.cpp) [Python](./Python/count-elements-with-at-least-k-greater-values.py) | _O(n)_ | _O(1)_ | 中等 | | 排序, 快速选择 3780 | [能被三整除的三个数的最大和](https://leetcode.com/problems/maximum-sum-of-three-numbers-divisible-by-three/) | [C++](./C++/maximum-sum-of-three-numbers-divisible-by-three.cpp) [Python](./Python/maximum-sum-of-three-numbers-divisible-by-three.py) | _O(n)_ | _O(1)_ | 中等 | | 排序, 数学 3799 | [单词正方形 II](https://leetcode.com/problems/word-squares-ii/) | [C++](./C++/word-squares-ii.cpp) [Python](./Python/word-squares-ii.py) | _O(n^4)_ | _O(1)_ | 中等 | | 排序, 暴力枚举, 哈希表 3886 | [可排序整数的和](https://leetcode.com/problems/sum-of-sortable-integers/) | [C++](./C++/sum-of-sortable-integers.cpp) [Python](./Python/sum-of-sortable-integers.py) | _O(nlog(logn))_ | _O(n)_ | 困难 | | 前缀和, 数论

## 双指针 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3006 | [查找给定数组中的美丽下标 I](https://leetcode.com/problems/find-beautiful-indices-in-the-given-array-i/) | [C++](./C++/find-beautiful-indices-in-the-given-array-i.cpp) [Python](./Python/find-beautiful-indices-in-the-given-array-i.py) | _O(n)_ | _O(min(a + b + x + y, n))_ | 中等 | | `KMP 算法`, 二分查找, 双指针 3008 | [查找给定数组中的美丽下标 II](https://leetcode.com/problems/find-beautiful-indices-in-the-given-array-ii/) | [C++](./C++/find-beautiful-indices-in-the-given-array-ii.cpp) [Python](./Python/find-beautiful-indices-in-the-given-array-ii.py) | _O(n)_ | _O(min(a + b + x + y, n))_ | 困难 | | `KMP 算法`, 二分查找, 双指针 3013 | [将数组划分为最小成本的子数组 II](https://leetcode.com/problems/divide-an-array-into-subarrays-with-minimum-cost-ii/) | [C++](./C++/divide-an-array-into-subarrays-with-minimum-cost-ii.cpp) [Python](./Python/divide-an-array-into-subarrays-with-minimum-cost-ii.py) | _O(nlogd)_ | _O(d)_ | 困难 | | 滑动窗口, 堆, 频率表, 有序集合, 二叉搜索树, 有序列表 3085 | [使字符串成为 K 特殊的最小删除操作](https://leetcode.com/problems/minimum-deletions-to-make-string-k-special/) | [C++](./C++/minimum-deletions-to-make-string-k-special.cpp) [Python](./Python/minimum-deletions-to-make-string-k-special.py) | _O(n + 26)_ | _O(n + 26)_ | 中等 | | 频率表, 计数排序, 双指针 3090 | [最多包含两个出现次数的最大长度子字符串](https://leetcode.com/problems/maximum-length-substring-with-two-occurrences/) | [C++](./C++/maximum-length-substring-with-two-occurrences.cpp) [Python](./Python/maximum-length-substring-with-two-occurrences.py) | _O(n + 26)_ | _O(26)_ | 简单 | | 频率表, 滑动窗口, 双指针 3095 | [按位或至少为 K 的最短子数组 I](https://leetcode.com/problems/shortest-subarray-with-or-at-least-k-i/) | [C++](./C++/shortest-subarray-with-or-at-least-k-i.cpp) [Python](./Python/shortest-subarray-with-or-at-least-k-i.py) | _O(n * 30)_ | _O(30)_ | 简单 | | 暴力枚举, 频率表, 双指针 3097 | [按位或至少为 K 的最短子数组 II](https://leetcode.com/problems/shortest-subarray-with-or-at-least-k-ii/) | [C++](./C++/shortest-subarray-with-or-at-least-k-ii.cpp) [Python](./Python/shortest-subarray-with-or-at-least-k-ii.py) | _O(n * 30)_ | _O(30)_ | 中等 | | 频率表, 双指针 3171 | [找到按位或最接近 K 的子数组](https://leetcode.com/problems/find-subarray-with-bitwise-or-closest-to-k/)| [C++](./C++/find-subarray-with-bitwise-or-closest-to-k.cpp) [Python](./Python/find-subarray-with-bitwise-or-closest-to-k.py) | _O(nlogr)_ | _O(logr)_ | 困难 | [找到最接近目标的神秘函数值](https://leetcode.com/problems/find-a-value-of-a-mysterious-function-closest-to-target/) 的变体 | 动态规划, 频率表, 双指针, 滑动窗口 3206 | [交替组 I](https://leetcode.com/problems/alternating-groups-i/)| [C++](./C++/alternating-groups-i.cpp) [Python](./Python/alternating-groups-i.py) | _O(n)_ | _O(1)_ | 简单 | | 双指针, 滑动窗口 3208 | [交替组 II](https://leetcode.com/problems/alternating-groups-ii/)| [C++](./C++/alternating-groups-ii.cpp) [Python](./Python/alternating-groups-ii.py) | _O(n)_ | _O(1)_ | 中等 | | 双指针, 滑动窗口 3234 | [统计包含优势 1 的子字符串数量](https://leetcode.com/problems/count-the-number-of-substrings-with-dominant-ones/)| [C++](./C++/count-the-number-of-substrings-with-dominant-ones.cpp) [Python](./Python/count-the-number-of-substrings-with-dominant-ones.py) | _O(n^(3/2))_ | _O(1)_ | 中等 | | 双指针, 滑动窗口 3254 | [求 K 大小子数组的幂 I](https://leetcode.com/problems/find-the-power-of-k-size-subarrays-i/)| [C++](./C++/find-the-power-of-k-size-subarrays-i.cpp) [Python](./Python/find-the-power-of-k-size-subarrays-i.py) | _O(n)_ | _O(1)_ | 中等 | | 双指针, 滑动窗口 3255 | [求 K 大小子数组的幂 II](https://leetcode.com/problems/find-the-power-of-k-size-subarrays-ii/)| [C++](./C++/find-the-power-of-k-size-subarrays-ii.cpp) [Python](./Python/find-the-power-of-k-size-subarrays-ii.py) | _O(n)_ | _O(1)_ | 中等 | | 双指针, 滑动窗口 3258 | [统计满足 K 约束的子字符串 I](https://leetcode.com/problems/count-substrings-that-satisfy-k-constraint-i/)| [C++](./C++/count-substrings-that-satisfy-k-constraint-i.cpp) [Python](./Python/count-substrings-that-satisfy-k-constraint-i.py) | _O(n)_ | _O(1)_ | 简单 | | 双指针, 滑动窗口 3261 | [统计满足 K 约束的子字符串 II](https://leetcode.com/problems/count-substrings-that-satisfy-k-constraint-ii/)| [C++](./C++/count-substrings-that-satisfy-k-constraint-ii.cpp) [Python](./Python/count-substrings-that-satisfy-k-constraint-ii.py) | _O(n)_ | _O(n)_ | 困难 | | 双指针, 滑动窗口, 前缀和, 哈希表 3264 | [K 次乘运算后的最终数组状态 I](https://leetcode.com/problems/final-array-state-after-k-multiplication-operations-i/)| [C++](./C++/final-array-state-after-k-multiplication-operations-i.cpp) [Python](./Python/final-array-state-after-k-multiplication-operations-i.py) | _O(nlogn)_ | _O(n)_ | 简单 | | 排序, 双指针, 滑动窗口, 快速幂, 堆, 二分查找, 模拟 3266 | [K 次乘运算后的最终数组状态 II](https://leetcode.com/problems/final-array-state-after-k-multiplication-operations-ii/)| [C++](./C++/final-array-state-after-k-multiplication-operations-ii.cpp) [Python](./Python/final-array-state-after-k-multiplication-operations-ii.py) | _O(nlogn)_ | _O(n)_ | 困难 | | 排序, 双指针, 滑动窗口, 快速幂, 堆, 二分查找 3297 | [统计可以重新排列包含字符串的子字符串 I](https://leetcode.com/problems/count-substrings-that-can-be-rearranged-to-contain-a-string-i/)| [C++](./C++/count-substrings-that-can-be-rearranged-to-contain-a-string-i.cpp) [Python](./Python/count-substrings-that-can-be-rearranged-to-contain-a-string-i.py) | _O(n + 26)_ | _O(26)_ | 中等 | | 双指针, 滑动窗口, 频率表 3298 | [统计可以重新排列包含字符串的子字符串 II](https://leetcode.com/problems/count-substrings-that-can-be-rearranged-to-contain-a-string-ii/)| [C++](./C++/count-substrings-that-can-be-rearranged-to-contain-a-string-ii.cpp) [Python](./Python/count-substrings-that-can-be-rearranged-to-contain-a-string-ii.py) | _O(n + 26)_ | _O(26)_ | 困难 | | 双指针, 滑动窗口, 频率表 3305 | [包含所有元音和 K 个辅音的子字符串计数 I](https://leetcode.com/problems/count-of-substrings-containing-every-vowel-and-k-consonants-i/)| [C++](./C++/count-of-substrings-containing-every-vowel-and-k-consonants-i.cpp) [Python](./Python/count-of-substrings-containing-every-vowel-and-k-consonants-i.py) | _O(n)_ | _O(1)_ | 中等 | | 双指针, 滑动窗口, 频率表 3306 | [包含所有元音和 K 个辅音的子字符串计数 II](https://leetcode.com/problems/count-of-substrings-containing-every-vowel-and-k-consonants-ii/)| [C++](./C++/count-of-substrings-containing-every-vowel-and-k-consonants-ii.cpp) [Python](./Python/count-of-substrings-containing-every-vowel-and-k-consonants-ii.py) | _O(n)_ | _O(1)_ | 中等 | | 双指针, 滑动窗口, 频率表 3318 | [查找所有 K 长度子数组的 X 和 I](https://leetcode.com/problems/find-x-sum-of-all-k-long-subarrays-i/)| [C++](./C++/find-x-sum-of-all-k-long-subarrays-i.cpp) [Python](./Python/find-x-sum-of-all-k-long-subarrays-i.py) | _O(nlogn)_ | _O(n)_ | 简单 | | 双指针, 滑动窗口, 频率表, 有序集合, 有序列表 3321 | [查找所有 K 长度子数组的 X 和 II](https://leetcode.com/problems/find-x-sum-of-all-k-long-subarrays-ii/)| [C++](./C++/find-x-sum-of-all-k-long-subarrays-ii.cpp) [Python](./Python/find-x-sum-of-all-k-long-subarrays-ii.py) | _O(nlogn)_ | _O(n)_ | 困难 | | 双指针, 滑动窗口, 频率表, 有序集合, 有序列表 3323 | [通过插入区间最小化连通组数](https://leetcode.com/problems/minimize-connected-groups-by-inserting-interval/) | [C++](./C++/minimize-connected-groups-by-inserting-interval.cpp) [Python](./Python/minimize-connected-groups-by-inserting-interval.py) | _O(nlogn)_ | _O(n)_ | 中等 | 🔒 | 排序, 前缀和, 双指针, 滑动窗口 3325 | [统计具有 K 频率字符的子字符串 I](https://leetcode.com/problems/count-substrings-with-k-frequency-characters-i/) | [C++](./C++/count-substrings-with-k-frequency-characters-i.cpp) [Python](./Python/count-substrings-with-k-frequency-characters-i.py) | _O(n + 26)_ | _O(26)_ | 中等 | | 频率表, 双指针, 滑动窗口 3329 | [统计具有 K 频率字符的子字符串 II](https://leetcode.com/problems/count-substrings-with-k-frequency-characters-ii/) | [C++](./C++/count-substrings-with-k-frequency-characters-ii.cpp) [Python](./Python/count-substrings-with-k-frequency-characters-ii.py) | _O(n + 26)_ | _O(26)_ | 困难 | 🔒 | 频率表, 双指针, 滑动窗口 3346 | [执行操作后元素的最大频率 I](https://leetcode.com/problems/maximum-frequency-of-an-element-after-performing-operations-i/) | [C++](./C++/maximum-frequency-of-an-element-after-performing-operations-i.cpp) [Python](./Python/maximum-frequency-of-an-element-after-performing-operations-i.py) | _O(nlogn)_ | _O(n)_ | 中等 | | 排序, 频率表, 双指针, 滑动窗口, 差分数组, 扫描线 3347 | [执行操作后元素的最大频率 II](https://leetcode.com/problems/maximum-frequency-of-an-element-after-performing-operations-ii/) | [C++](./C++/maximum-frequency-of-an-element-after-performing-operations-ii.cpp) [Python](./Python/maximum-frequency-of-an-element-after-performing-operations-ii.py) | _O(nlogn)_ | _O(n)_ | 困难 | | 排序, 频率表, 双指针, 滑动窗口, 差分数组, 扫描线 3364 | [最小正和子数组](https://leetcode.com/problems/minimum-positive-sum-subarray/) | [C++](./C++/minimum-positive-sum-subarray.cpp) [Python](./Python/minimum-positive-sum-subarray.py) | _O(nlogn)_ | _O(n)_ | 简单 | | 前缀和, 双指针, 滑动窗口, 有序列表, 二叉搜索树, 二分查找 3413 | [K 个连续袋子能获得的最大硬币数](_URL_1318/>) | [C++](./C++/maximum-coins-from-k-consecutive-bags.cpp) [Python](./Python/maximum-coins-from-k-consecutive-bags.py) | _O(nlogn)_ | _O(1)_ | 中等 | | 排序, 双指针, 滑动窗口 3420 | [K 次操作后的非递减子数组计数](https://leetcode.com/problems/count-non-decreasing-subarrays-after-k-operations/) | [C++](./C++/count-non-decreasing-subarrays-after-k-operations.cpp) [Python](./Python/count-non-decreasing-subarrays-after-k-operations.py) | _O(n)_ | _O(n)_ | 困难 | | 单调双端队列, 双指针, 滑动窗口 3422 | [使子数组元素相等的最小操作次数](https://leetcode.com/problems/minimum-operations-to-make-subarray-elements-equal/) | [C++](./C++/minimum-operations-to-make-subarray-elements-equal.cpp) [Python](./Python/minimum-operations-to-make-subarray-elements-equal.py) | _O(nlogk)_ | _O(k)_ | 中等 | 🔒 | 数学, 双指针, 滑动窗口, 有序列表, 二叉搜索树 3425 | [最长特殊路径](https://leetcode.com/problems/longest-special-path/) | [C++](./C++/longest-special-path.cpp) [Python](./Python/longest-special-path.py) | _O(n + e)_ | _O(n + e)_ | 困难 | | DFS, 双指针, 滑动窗口, 前缀和 3430 | [最大和最小的最多大小为 K 的子数组之和](https://leetcode.com/problems/maximum-and-minimum-sums-of-at-most-size-k-subarrays/) | [C++](./C++/maximum-and-minimum-sums-of-at-most-size-k-subarrays.cpp) [Python](./Python/maximum-and-minimum-sums-of-at-most-size-k-subarrays.py) | _O(n)_ | _O(k)_ | 困难 | | 双指针, 滑动窗口, 单调双端队列 3439 | [重新安排会议以获得最大空闲时间 I](https://leetcode.com/problems/reschedule-meetings-for-maximum-free-time-i/) | [C++](./C++/reschedule-meetings-for-maximum-free-time-i.cpp) [Python](./Python/reschedule-meetings-for-maximum-free-time-i.py) | _O(n)_ | _O(1)_ | 中等 | | 双指针, 滑动窗口 3445 | [偶数和奇数频率之间的最大差异 II](https://leetcode.com/problems/maximum-difference-between-even-and-odd-frequency-ii/) | [C++](./C++/maximum-difference-between-even-and-odd-frequency-ii.cpp) [Python](./Python/maximum-difference-between-even-and-odd-frequency-ii.py) | _O(d^2 * n)_ | _O(n)_ | 困难 | | 前缀和, 双指针, 滑动窗口 3460 | [最多一次移除后的最长公共前缀](https://leetcode.com/problems/longest-common-prefix-after-at-most-one-removal/) | [C++](./C++/longest-common-prefix-after-at-most-one-removal.cpp) [Python](./Python/longest-common-prefix-after-at-most-one-removal.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | 双指针 3485 | [移除后 K 个字符串的最长公共前缀](https://leetcode.com/problems/longest-common-prefix-of-k-strings-after-removal/) | [C++](./C++/longest-common-prefix-of-k-strings-after-removal.cpp) [Python](./Python/longest-common-prefix-of-k-strings-after-removal.py) | _O(l * nlogn)_ | _O(n)_ | 困难 | | 排序, 滑动窗口, 前缀和, 字典树 3486 | [最长特殊路径 II](https://leetcode.com/problems/longest-special-path-ii/) | [C++](./C++/longest-special-path-ii.cpp) [Python](./Python/longest-special-path-ii.py) | _O(n + e)_ | _O(n + e)_ | 困难 | | DFS, 双指针, 滑动窗口, 前缀和 3555 | [每个滑动窗口中要排序的最小子数组](https://leetcode.com/problems/smallest-subarray-to-sort-in-every-sliding-window/) | [C++](./C++/smallest-subarray-to-sort-in-every-sliding-window.cpp) [Python](./Python/smallest-subarray-to-sort-in-every-sliding-window.py) | _O(n)_ | _O(n)_ | 中等 | 🔒 | 单调栈, 双指针 3567 | [滑动子矩阵中的最小绝对差](https://leetcode.com/problems/minimum-absolute-difference-in-sliding-submatrix/) | [C++](./C++/minimum-absolute-difference-in-sliding-submatrix.cpp) [Python](./Python/minimum-absolute-difference-in-sliding-submatrix.py) | _O(m * n * k^2)_ | _O(k^2)_ | 中等 | | 暴力枚举, 排序, 双指针, 滑动窗口, 二叉搜索树, 有序列表 3584 | [子序列首尾元素的最大乘积](https://leetcode.com/problems/maximum-product-of-first-and-last-elements-of-a-subsequence/) | [C++](./C++/maximum-product-of-first-and-last-elements-of-a-subsequence.cpp) [Python](./Python/maximum-product-of-first-and-last-elements-of-a-subsequence.py) | _O(n)_ | _O(1)_ | 中等 | | 双指针, 滑动窗口 3589 | [统计素数间距平衡的子数组](https://leetcode.com/problems/count-prime-gap-balanced-subarrays/) | [C++](./C++/count-prime-gap-balanced-subarrays.cpp) [Python](./Python/count-prime-gap-balanced-subarrays.py) | 预计算: _O(r)_
运行时: _O(n)_ | _O(r)_ | 中等 | | 数论, `Linear Sieve of Eratosthenes`, 单调双端队列, 双指针, 滑动窗口 3634 | [平衡数组的最小移除数](https://leetcode.com/problems/minimum-removals-to-balance-array/) | [C++](./C++/minimum-removals-to-balance-array.cpp) [Python](./Python/minimum-removals-to-balance-array.py) | _O(nlogn)_ | _O(1)_ | 中等 | | 排序, 双指针, 滑动窗口 3640 | [三进制数组 II](https://leetcode.com/problems/trionic-array-ii/) | [C++](./C++/trionic-array-ii.cpp) [Python](./Python/trionic-array-ii.py) | _O(n)_ | _O(1)_ | 简单 | | 双指针, 滑动窗口, 贪心 3641 | [最长半重复子数组](https://leetcode.com/problems/longest-semi-repeating-subarray/) | [C++](./C++/longest-semi-repeating-subarray.cpp) [Python](./Python/longest-semi-repeating-subarray.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | 频率表, 双指针, 滑动窗口 3649 | [完美对的数量](https://leetcode.com/problems/number-of-perfect-pairs/) | [C++](./C++/number-of-perfect-pairs.cpp) [Python](./Python/number-of-perfect-pairs.py) | _O(nlogn)_ | _O(1)_ | 中等 | | 排序, 双指针, 滑动窗口, 数学 3652 | [使用策略买卖股票的最佳时机](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-using-strategy/) | [C++](./C++/best-time-to-buy-and-sell-stock-using-strategy.cpp) [Python](./Python/best-time-to-buy-and-sell-stock-using-strategy.py) | _O(n)_ | _O(1)_ | 中等 | | 双指针, 滑动窗口 3672 | [子数组中加权众数之和](https://leetcode.com/problems/sum-of-weighted-modes-in-subarrays/) | [C++](./C++/sum-of-weighted-modes-in-subarrays.cpp) [Python](./Python/sum-of-weighted-modes-in-subarrays.py) | _O(nlogk)_ | _O(k)_ | 中等 | 🔒 | 有序列表, 二叉搜索树, 双指针, 滑动窗口 3679 | [平衡库存的最小丢弃数](https://leetcode.com/problems/minimum-discards-to-balance-inventory/) | [C++](./C++/minimum-discards-to-balance-inventory.cpp) [Python](./Python/minimum-discards-to-balance-inventory.py) | _O(n)_ | _O(w)_ | 中等 | | 频率表, 双指针, 滑动窗口 3698 | [以最小差值拆分数组](https://leetcode.com/problems/split-array-with-minimum-difference/) | [C++](./C++/split-array-with-minimum-difference.cpp) [Python](./Python/split-array-with-minimum-difference.py) | _O(n)_ | _O(1)_ | 中等 | | 双指针 3740 | [三个相等元素之间的最小距离 I](https://leetcode.com/problems/minimum-distance-between-three-equal-elements-i/) | [C++](./C++/minimum-distance-between-three-equal-elements-i.cpp) [Python](./Python/minimum-distance-between-three-equal-elements-i.py) | _O(n)_ | _O(n)_ | 简单 | | 哈希表, 双指针, 滑动窗口 3741 | [三个相等元素之间的最小距离 II](https://leetcode.com/problems/minimum-distance-between-three-equal-elements-ii/) | [C++](./C++/minimum-distance-between-three-equal-elements-ii.cpp) [Python](./Python/minimum-distance-between-three-equal-elements-ii.py) | _O(n)_ | _O(n)_ | 中等 | | 哈希表, 双指针, 滑动窗口 3768 | [固定长度子数组中的最小逆序数](https://leetcode.com/problems/minimum-inversion-count-in-subarrays-of-fixed-length/) | [C++](./C++/minimum-inversion-count-in-subarrays-of-fixed-length.cpp) [Python](./Python/minimum-inversion-count-in-subarrays-of-fixed-length.py) | _O(nlogn)_ | _O(n)_ | 困难 | | 排序, 坐标压缩, 树状数组, Fenwick Tree, 双指针, 滑动窗口 3795 | [具有不同总和且至少为 K 的最小子数组长度](https://leetcode.com/problems/minimum-subarray-length-with-distinct-sum-at-least-k/) | [C++](./C++/minimum-subarray-length-with-distinct-sum-at-least-k.cpp) [Python](./Python/minimum-subarray-length-with-distinct-sum-at-least-k.py) | _O(n)_ | _O(n)_ | 中等 | | 频率表, 双指针, 滑动窗口 3802 | [涂色纸张的方案数](https://leetcode.com/problems/number-of-ways-to-paint-sheets/) | [C++](./C++/number-of-ways-to-paint-sheets.cpp) [Python](./Python/number-of-ways-to-paint-sheets.py) | _O(mlogm)_ | _O(m)_ | 困难 | 🔒 | 前缀和, 双指针 3835 | [统计成本小于等于 K 的子数组](https://leetcode.com/problems/count-subarrays-with-cost-less-than-or-equal-to-k/) | [C++](./C++/count-subarrays-with-cost-less-than-or-equal-to-k.cpp) [Python](./Python/count-subarrays-with-cost-less-than-or-equal-to-k.py) | _O(n)_ | _O(n)_ | 中等 | | 单调双端队列, 双指针, 滑动窗口 3844 | [最长几乎回文子串](https://leetcode.com/problems/longest-almost-palindromic-substring/) | [C++](./C++/longest-almost-palindromic-substring.cpp) [Python](./Python/longest-almost-palindromic-substring.py) | _O(n^2)_ | _O(1)_ | 中等 | | 双指针 3845 | [有界范围内的最大子数组异或](https://leetcode.com/problems/maximum-subarray-xor-with-bounded-range/) | [C++](./C++/maximum-subarray-xor-with-bounded-range.cpp) [Python](./Python/maximum-subarray-xor-with-bounded-range.py) | _O(nlogr)_ | _O(n)_ | 困难 | | 双指针, 滑动窗口, 单调双端队列, 位运算, 前缀和, 字典树, 哈希表 3851 | [不违反限制的最大请求数](https://leetcode.com/problems/maximum-requests-without-violating-the-limit/) | [C++](./C++/maximum-requests-without-violating-the-limit.cpp) [Python](./Python/maximum-requests-without-violating-the-limit.py) | _O(nlogn)_ | _O(n)_ | 中等 | 🔒 | 哈希表, 排序, 双端队列, 双指针, 滑动窗口 3859 | [统计具有 K 个不同整数的子数组](https://leetcode.com/problems/count-subarrays-with-k-distinct-integers/) | [C++](./C++/count-subarrays-with-k-distinct-integers.cpp) [Python](./Python/count-subarrays-with-k-distinct-integers.py) | _O(n)_ | _O(n)_ | 困难 | | 频率表, 双指针, 滑动窗口 3872 | [改变最多一个元素后的最长等差数列](https://leetcode.com/problems/longest-arithmetic-sequence-after-changing-at-most-one-element/) | [C++](./C++/longest-arithmetic-sequence-after-changing-at-most-one-element.cpp) [Python](./Python/longest-arithmetic-sequence-after-changing-at-most-one-element.py) | _O(n)_ | _O(1)_ | 中等 | | 双指针 3874 | [恰好有一个峰值的有效子数组](https://leetcode.com/problems/valid-subarrays-with-exactly-one-peak/) | [C++](./C++/valid-subarrays-with-exactly-one-peak.cpp) [Python](./Python/valid-subarrays-with-exactly-one-peak.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | 组合数学, 双指针

## 递归 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----|

## 二分查找 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3048 | [标记索引的最早秒数 I](https://leetcode.com/problems/earliest-second-to-mark-indices-i/) | [C++](./C++/earliest-second-to-mark-indices-i.cpp) [Python](./Python/earliest-second-to-mark-indices-i.py) | _O(mlogm)_ | _O(n)_ | 中等 | | 二分查找, 贪心 | 3049 | [标记索引的最早秒数 II](https://leetcode.com/problems/earliest-second-to-mark-indices-ii/) | [C++](./C++/earliest-second-to-mark-indices-ii.cpp) [Python](./Python/earliest-second-to-mark-indices-ii.py) | _O((m + nlogn) *logm)_ | _O(n)_ | 困难 | | 二分查找, 贪心, 堆 | 3104 | [查找最长的自包含子串](https://leetcode.com/problems/find-longest-self-contained-substring/) | [C++](./C++/find-longest-self-contained-substring.cpp) [Python](./Python/find-longest-self-contained-substring.py) | _O(n + 26^3 * logn)_ | _O(n)_ | 困难 | 🔒 | 暴力枚举, 频率表 双指针, 哈希表, 二分查找 | 3116 | [单面额组合的第 K 小金额](https://leetcode.com/problems/kth-smallest-amount-with-single-denomination-combination/) | [C++](./C++/kth-smallest-amount-with-single-denomination-combination.cpp) [Python](./Python/kth-smallest-amount-with-single-denomination-combination.py) | _O(n * 2^n * logk)_ | _O(2^n)_ | 困难 | | 二分查找, 容斥原理, 数论 | 3134 | [求唯一性数组的中位数](https://leetcode.com/problems/find-the-median-of-the-uniqueness-array/) | [C++](./C++/find-the-median-of-the-uniqueness-array.cpp) [Python](./Python/find-the-median-of-the-uniqueness-array.py) | _O(nlogn)_ | _O(n)_ | 困难 | | 二分查找, 双指针, 滑动窗口 | 3135 | [通过在两端添加或移除字符来使字符串相等](https://leetcode.com/problems/equalize-strings-by-adding-or-removing-characters-at-ends/) | [C++](./C++/equalize-strings-by-adding-or-removing-characters-at-ends.cpp) [Python](./Python/equalize-strings-by-adding-or-removing-characters-at-ends.py) | _O((n + m) * log(min(n, m)))_ | _O(min(n, m))_ | 中等 | 🔒 | 二分查找, `Rabin-Karp 算法`, 滚动哈希, 动态规划 3145 | [查找大数组中元素的乘积](https://leetcode.com/problems/find-products-of-elements-of-big-array/) | [C++](./C++/find-products-of-elements-of-big-array.cpp) [Python](./Python/find-products-of-elements-of-big-array.py) | _O(q * (logr)^2)_ | _O(1)_ | 困难 | | 二分查找, 组合数学, 位运算, 快速幂 3231 | [要删除的递增子序列的最小数量](https://leetcode.com/problems/minimum-number-of-increasing-subsequence-to-be-removed/) | [C++](./C++/minimum-number-of-increasing-subsequence-to-be-removed.cpp) [Python](./Python/minimum-number-of-increasing-subsequence-to-be-removed.py) | _O(nlogn)_ | _O(n)_ | 困难 | 🔒, [最长递增子序列](https://leetcode.com/problems/longest-increasing-subsequence/) 的变体 | 二分查找 3233 | [统计不是特殊数字的个数](https://leetcode.com/problems/find-the-count-of-numbers-which-are-not-special/) | [C++](./C++/find-the-count-of-numbers-which-are-not-special.cpp) [Python](./Python/find-the-count-of-numbers-which-are-not-special.py) | 预计算: _O(sqrt(r))_
运行时: _O(logr)_ | _O(sqrt(r))_ | 中等 | | 数论, `Linear Sieve of Eratosthenes`, 二分查找 | 3281 | [最大化区间内数字的分数](https://leetcode.com/problems/maximize-score-of-numbers-in-ranges/) | [C++](./C++/maximize-score-of-numbers-in-ranges.cpp) [Python](./Python/maximize-score-of-numbers-in-ranges.py) | _O(nlogr)_ | _O(1)_ | 中等 | | 二分查找, 贪心 3288 | [最长递增路径的长度](https://leetcode.com/problems/length-of-the-longest-increasing-path/) | [C++](./C++/length-of-the-longest-increasing-path.cpp) [Python](./Python/length-of-the-longest-increasing-path.py) | _O(nlogn)_ | _O(n)_ | 困难 | | 排序, 二分查找, 最长递增子序列 3296 | [使山高为零的最小秒数](https://leetcode.com/problems/minimum-number-of-seconds-to-make-mountain-height-zero/) | [C++](./C++/minimum-number-of-seconds-to-make-mountain-height-zero.cpp) [Python](./Python/minimum-number-of-seconds-to-make-mountain-height-zero.py) | _O(nlogr)_ | _O(1)_ | 中等 | | 二分查找, 一元二次方程, 堆 3356 | [零数组变换 II](https://leetcode.com/problems/zero-array-transformation-ii/) | [C++](./C++/zero-array-transformation-ii.cpp) [Python](./Python/zero-array-transformation-ii.py) | _O((n + q) * logn)_ | _O(n)_ | 中等 | | 二分查找, 扫描线 3357 | [最小化相邻元素的最大差值](https://leetcode.com/problems/minimize-the-maximum-adjacent-element-difference/) | [C++](./C++/minimize-the-maximum-adjacent-element-difference.cpp) [Python](./Python/minimize-the-maximum-adjacent-element-difference.py) | _O(nlogr)_ | _O(1)_ | 困难 | | 二分查找 3398 | [具有相同字符的最小子字符串 I](https://leetcode.com/problems/smallest-substring-with-identical-characters-i/) | [C++](./C++/smallest-substring-with-identical-characters-i.cpp) [Python](./Python/smallest-substring-with-identical-characters-i.py) | _O(nlogn)_ | _O(1)_ | 困难 | | 二分查找, 贪心 3399 | [具有相同字符的最小子字符串 II](https://leetcode.com/problems/smallest-substring-with-identical-characters-ii/) | [C++](./C++/smallest-substring-with-identical-characters-ii.cpp) [Python](./Python/smallest-substring-with-identical-characters-ii.py) | _O(nlogn)_ | _O(1)_ | 困难 | | 二分查找, 贪心 3449 | [最大化最低游戏分数](https://leetcode.com/problems/maximize-the-minimum-game-score/) | [C++](./C++/maximize-the-minimum-game-score.cpp) [Python](./Python/maximize-the-minimum-game-score.py) | _O(n * log(m * r))_ | _O(1)_ | 困难 | | 二分查找, 贪心 3464 | [最大化正方形上点之间的距离](https://leetcode.com/problems/maximize-the-distance-between-points-on-a-square/) | [C++](./C++/maximize-the-distance-between-points-on-a-square.cpp) [Python](./Python/maximize-the-distance-between-points-on-a-square.py) | _O(nlogn + nlogs)_ | _O(n)_ | 困难 | | 排序, 二分查找, 贪心, 双指针, 滑动窗口 3477 | [将水果放入篮子 II](https://leetcode.com/problems/fruits-into-baskets-ii/) | [C++](./C++/fruits-into-baskets-ii.cpp) [Python](./Python/fruits-into-baskets-ii.py) | _O(nlogn)_ | _O(n)_ | 简单 | | 线段树, 二分查找, 暴力枚举 3479 | [将水果放入篮子 III](https://leetcode.com/problems/fruits-into-baskets-iii/) | [C++](./C++/fruits-into-baskets-iii.cpp) [Python](./Python/fruits-into-baskets-iii.py) | _O(nlogn)_ | _O(n)_ | 中等 | | 线段树, 二分查找 3520 | [逆序对数的最小阈值](https://leetcode.com/problems/minimum-threshold-for-inversion-pairs-count/)|[C++](./C++/minimum-threshold-for-inversion-pairs-count.cpp) [Python](./Python/minimum-threshold-for-inversion-pairs-count.py) | _O(nlogn * logr)_ | _O(n)_ | 中等 | 🔒 | 二分查找, 有序列表, 有序集合 3605 | [数组的最小稳定因子](https://leetcode.com/problems/minimum-stability-factor-of-array/)|[C++](./C++/minimum-stability-factor-of-array.cpp) [Python](./Python/minimum-stability-factor-of-array.py) | _O(nlogn * logr)_ | _O(nlogn)_ | 困难 | | 数论, 二分查找, RMQ, 稀疏表, 贪心 3722 | [反转后字典序最小的字符串](https://leetcode.com/problems/lexicographically-smallest-string-after-reverse/) | [C++](./C++/lexicographically-smallest-string-after-reverse.cpp) [Python](./Python/lexicographically-smallest-string-after-reverse.py) | _O(nlogn)_ | _O(n)_ | 中等 | | 字符串, 暴力枚举, 二分查找, `Rabin-Karp 算法`, 滚动哈希 3733 | [完成所有配送的最短时间](https://leetcode.com/problems/minimum-time-to-complete-all-deliveries/)|[C++](./C++/minimum-time-to-complete-all-deliveries.cpp) [Python](./Python/minimum-time-to-complete-all-deliveries.py) | _O(logr + logd)_ | _O(1)_ | 中等 | | 二分查找 3735 | [反转后字典序最小的字符串 II](https://leetcode.com/problems/lexicographically-smallest-string-after-reverse-ii/)|[C++](./C++/lexicographically-smallest-string-after-reverse-ii.cpp) [Python](./Python/lexicographically-smallest-string-after-reverse-ii.py) | _O(nlogn)_ | _O(n)_ | 困难 | 🔒 | 二分查找, `Rabin-Karp 算法`, 滚动哈希 3771 | [地下城通关的总分数](https://leetcode.com/problems/total-score-of-dungeon-runs/)|[C++](./C++/total-score-of-dungeon-runs.cpp) [Python](./Python/total-score-of-dungeon-runs.py) | _O(nlogn)_ | _O(n)_ | 中等 | | 前缀和, 二分查找 3807 | [修复边以遍历图的最小成本](https://leetcode.com/problems/minimum-cost-to-repair-edges-to-traverse-a-graph/)|[C++](./C++/minimum-cost-to-repair-edges-to-traverse-a-graph.cpp) [Python](./Python/minimum-cost-to-repair-edges-to-traverse-a-graph.py) | _O((n + m) * logr)_ | _O(n + m)_ | 中等 | 🔒 | 二分查找, BFS 3824 | [在限制内减少数组的最小 K 值](https://leetcode.com/problems/minimum-k-to-reduce-array-within-limit/)|[C++](./C++/minimum-k-to-reduce-array-within-limit.cpp) [Python](./Python/minimum-k-to-reduce-array-within-limit.py) | _O(nlogn + nlogr)_ | _O(1)_ | 中等 | | 二分查找 3825 | [非零按位与的最长严格递增子序列](https://leetcode.com/problems/longest-strictly-increasing-subsequence-with-non-zero-bitwise-and/)|[C++](./C++/longest-strictly-increasing-subsequence-with-non-zero-bitwise-and.cpp) [Python](./Python/longest-strictly-increasing-subsequence-with-non-zero-bitwise-and.py) | _O(logr * nlogn)_ | _O(n)_ | 中等 | | 位运算, LIS, 最长递增子序列, 二分查找 3826 | [最小分割分数](https://leetcode.com/problems/minimum-partition-score/)|[C++](./C++/minimum-partition-score.cpp) [Python](./Python/minimum-partition-score.py) | _O(nlogn + nlogr)_ | _O(n)_ | 困难 | | 前缀和, 动态规划, 凸包技巧, WQS 二分, Alien Trick 3893 | [具有重叠区间的最大团队规模](https://leetcode.com/problems/maximum-team-size-with-overlapping-intervals/)|[C++](./C++/maximum-team-size-with-overlapping-intervals.cpp) [Python](./Python/maximum-team-size-with-overlapping-intervals.py) | _O(nlogn)_ | _O(n)_ | 中等 | 🔒 | 排序, 二分查找 3911 | [子数组查询中第 K 个最小的剩余偶数](https://leetcode.com/problems/k-th-smallest-remaining-even-integer-in-subarray-queries/)|[C++](./C++/k-th-smallest-remaining-even-integer-in-subarray-queries.cpp) [Python](./Python/k-th-smallest-remaining-even-integer-in-subarray-queries.py) | _O(n + qlogn)_ | _O(n)_ | 困难 | | 前缀和, 二分查找 3920 | [删除后最大化固定点数](https://leetcode.com/problems/maximize-fixed-points-after-deletions/) | [C++](./C++/maximize-fixed-points-after-deletions.cpp) [Python](./Python/maximize-fixed-points-after-deletions.py) | _O(nlogn)_ | _O(n)_ | 困难 | | 排序, 二分查找, 最长递增子序列

## 二叉搜索树 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3072 | [将元素分配到两个数组 II](https://leetcode.com/problems/distribute-elements-into-two-arrays-ii/) | [C++](./C++/distribute-elements-into-two-arrays-ii.cpp) [Python](./Python/distribute-elements-into-two-arrays-ii.py) | _O(nlogn)_ | _O(n)_ | 困难 | | 有序列表, 有序集合 3073 | [最大递增三元组值](https://leetcode.com/problems/maximum-increasing-triplet-value/) | [C++](./C++/maximum-increasing-triplet-value.cpp) [Python](./Python/maximum-increasing-triplet-value.py) | _O(nlogn)_ | _O(n)_ | 中等 | 🔒 | 有序列表, 二叉搜索树, 前缀和 3161 | [块放置查询](https://leetcode.com/problems/block-placement-queries/) | [C++](./C++/block-placement-queries.cpp) [Python](./Python/block-placement-queries.py) | _O(qlogq)_ | _O(q)_ | 困难 | | 有序列表, 二叉搜索树, 树状数组, Fenwick Tree, 线段树 3165 | [不包含相邻元素的最大子序列和](https://leetcode.com/problems/maximum-sum-of-subsequence-with-non-adjacent-elements/) | [C++](./C++/maximum-sum-of-subsequence-with-non-adjacent-elements.cpp) [Python](./Python/maximum-sum-of-subsequence-with-non-adjacent-elements.py) | _O(n + qlogn)_ | _O(n)_ | 困难 | | 线段树 3526 | [子数组反转的范围 XOR 查询](https://leetcode.com/problems/range-xor-queries-with-subarray-reversals/) | [C++](./C++/range-xor-queries-with-subarray-reversals.cpp) [Python](./Python/range-xor-queries-with-subarray-reversals.py) | _O(n + qlogn)_ | _O(n)_ | 困难 | 🔒 | Treap

## 广度优先搜索 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3157 | [找到树中和最小的层]()| [C++](./C++/find-the-level-of-tree-with-minimum-sum.cpp) [Python](./Python/find-the-level-of-tree-with-minimum-sum.py)| _O(n)_ | _O(w)_ | 中等 | 🔒 | BFS | 3286 | [在网格中找到安全走法](https://leetcode.com/problems/find-a-safe-walk-through-a-grid/)| [C++](./C++/find-a-safe-walk-through-a-grid.cpp) [Python](./Python/find-a-safe-walk-through-a-grid.py)| _O(m * n)_ | _O(m * n)_ | 中等 | [到达角落的最小障碍物移除](https://leetcode.com/problems/minimum-obstacle-removal-to-reach-corner/) 的变体 | 0-1 BFS, 双端队列 | 3373 | [连接两棵树后最大化目标节点数 II](https://leetcode.com/problems/maximize-the-number-of-target-nodes-after-connecting-trees-ii/) | [C++](./C++/maximize-the-number-of-target-nodes-after-connecting-trees-ii.cpp) [Python](./Python/maximize-the-number-of-target-nodes-after-connecting-trees-ii.py) | _O(n + m)_ | _O(n + m)_ | 困难 | | BFS 3528 | [单位换算 I](https://leetcode.com/problems/unit-conversion-i/) | [C++](./C++/unit-conversion-i.cpp) [Python](./Python/unit-conversion-i.py) | _O(n)_ | _O(n)_ | 中等 | | BFS 3535 | [单位换算 II](https://leetcode.com/problems/unit-conversion-ii/) | [C++](./C++/unit-conversion-ii.cpp) [Python](./Python/unit-conversion-ii.py) | _O(n + qlogm)_ | _O(n)_ | 中等 | 🔒 | BFS, 快速幂 3552 | [网格传送遍历](https://leetcode.com/problems/grid-teleportation-traversal/) | [C++](./C++/grid-teleportation-traversal.cpp) [Python](./Python/grid-teleportation-traversal.py) | _O(m * n)_ | _O(m * n)_ | 中等 | | 0-1 BFS, 双端队列 3568 | [打扫教室的最小移动次数](https://leetcode.com/problems/minimum-moves-to-clean-the-classroom/) | [C++](./C++/minimum-moves-to-clean-the-classroom.cpp) [Python](./Python/minimum-moves-to-clean-the-classroom.py) | _O(m * n * 2^l)_ | _O(m * n * 2^l)_ | 中等 | | BFS, 位运算 3619 | [统计可被 K 整除的岛屿总数](https://leetcode.com/problems/count-islands-with-total-value-divisible-by-k/)| [C++](./C++/count-islands-with-total-value-divisible-by-k.cpp) [Python](./Python/count-islands-with-total-value-divisible-by-k.py)| _O(m * n)_ | _O(m + n)_ | 中等 | | BFS, 泛洪填充 | 3629 | [通过素数传送到达终点的最小跳跃次数](https://leetcode.com/problems/minimum-jumps-to-reach-end-via-prime-teleportation/) | [C++](./C++/minimum-jumps-to-reach-end-via-prime-teleportation.cpp) [Python](./Python/minimum-jumps-to-reach-end-via-prime-teleportation.py) | 预计算: _O(r)_
运行时: _O(nlogr)_ | _O(r + nlogr)_ | 中等 | | 数论, `Linear Sieve of Eratosthenes`, BFS 3690 | [拆分与合并数组转换](https://leetcode.com/problems/split-and-merge-array-transformation/) | [C++](./C++/split-and-merge-array-transformation.cpp) [Python](./Python/split-and-merge-array-transformation.py) | _O(n^4 * n!)_ | _O(n * n!)_ | 中等 | | BFS 3695 | [使用交换最大化交替和](https://leetcode.com/problems/maximize-alternating-sum-using-swaps/) | [C++](./C++/maximize-alternating-sum-using-swaps.cpp) [Python](./Python/maximize-alternating-sum-using-swaps.py) | _O(n + s)_ | _O(n + s)_ | 困难 | | BFS, 泛洪填充, 快速选择 3786 | [树组中交互成本的总和](https://leetcode.com/problems/total-sum-of-interaction-cost-in-tree-groups/)| [C++](./C++/total-sum-of-interaction-cost-in-tree-groups.cpp) [Python](./Python/total-sum-of-interaction-cost-in-tree-groups.py)| _O(nlogn)_ | _O(n)_ | 困难 | | BFS, DFS, 启发式合并 | 3787 | [寻找树的直径端点](https://leetcode.com/problems/find-diameter-endpoints-of-a-tree/)| [C++](./C++/find-diameter-endpoints-of-a-tree.cpp) [Python](./Python/find-diameter-endpoints-of-a-tree.py)| _O(n)_ | _O(n)_ | 中等 | 🔒 | BFS, 树的直径 | 3820 | [树中的勾股距离节点](https://leetcode.com/problems/pythagorean-distance-nodes-in-a-tree/)| [C++](./C++/pythagorean-distance-nodes-in-a-tree.cpp) [Python](./Python/pythagorean-distance-nodes-in-a-tree.py)| _O(n)_ | _O(n)_ | 中等 | | BFS | 3831 | [二叉搜索树层数的中位数](https://leetcode.com/problems/median-of-a-binary-search-tree-level/)| [C++](./C++/median-of-a-binary-search-tree-level.cpp) [Python](./Python/median-of-a-binary-search-tree-level.py)| _O(n)_ | _O(n)_ | 中等 | 🔒 | BFS | 3902 | [二叉树的锯齿层和](https://leetcode.com/problems/zigzag-level-sum-of-binary-tree/)| [C++](./C++/zigzag-level-sum-of-binary-tree.cpp) [Python](./Python/zigzag-level-sum-of-binary-tree.py)| _O(n)_ | _O(w)_ | 困难 | 🔒 | BFS | 3905 | [多源泛洪填充](https://leetcode.com/problems/multi-source-flood-fill/)| [C++](./C++/multi-source-flood-fill.cpp) [Python](./Python/multi-source-flood-fill.py)| _O(n * m)_ | _O(n * m)_ | 中等 | | 排序, BFS, 泛洪填充 |

## 深度优先搜索 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3004 | [相同颜色的最大子树](https://leetcode.com/problems/maximum-subtree-of-the-same-color/)| [C++](./C++/maximum-subtree-of-the-same-color.cpp) [Python](./Python/maximum-subtree-of-the-same-color.py)| _O(n)_ | _O(h)_ | 中等 | 🔒 | DFS | 3067 | [统计加权树网络中可连接的服务器对数](https://leetcode.com/problems/count-pairs-of-connectable-servers-in-a-weighted-tree-network/)| [C++](./C++/count-pairs-of-connectable-servers-in-a-weighted-tree-network.cpp) [Python](./Python/count-pairs-of-connectable-servers-in-a-weighted-tree-network.py)| _O(n^2)_ | _O(n)_ | 中等 | | DFS, BFS | 3203 | [合并两棵树后的最小直径](https://leetcode.com/problems/find-minimum-diameter-after-merging-two-trees/)| [C++](./C++/find-minimum-diameter-after-merging-two-trees.cpp) [Python](./Python/find-minimum-diameter-after-merging-two-trees.py)| _O(n + m)_ | _O(n + m)_ | 困难 | [树的直径](https://leetcode.com/problems/tree-diameter/) 的变体 | DFS, BFS, 树形动态规划, 树的直径 | 3249 | [统计好节点的数目](https://leetcode.com/problems/count-the-number-of-good-nodes/)| [C++](./C++/count-the-number-of-good-nodes.cpp) [Python](./Python/count-the-number-of-good-nodes.py)| _O(n)_ | _O(h)_ | 中等 | | DFS | 3319 | [二叉树中第 K 大的完美子树的大小](https://leetcode.com/problems/k-th-largest-perfect-subtree-size-in-binary-tree/)| [C++](./C++/k-th-largest-perfect-subtree-size-in-binary-tree.cpp) [Python](./Python/k-th-largest-perfect-subtree-size-in-binary-tree.py)| _O(n)_ | _O(n)_ | 中等 | | DFS, 快速选择 | 3327 | [判断 DFS 字符串是否为回文](https://leetcode.com/problems/check-if-dfs-strings-are-palindromes/)| [C++](./C++/check-if-dfs-strings-are-palindromes.cpp) [Python](./Python/check-if-dfs-strings-are-palindromes.py)| _O(n)_ | _O(n)_ | 困难 | | DFS, `Manacher 算法` | 3331 | [更改后查找子树大小](https://leetcode.com/problems/find-subtree-sizes-after-changes/)| [C++](./C++/find-subtree-sizes-after-changes.cpp) [Python](./Python/find-subtree-sizes-after-changes.py)| _O(n)_ | _O(n)_ | 中等 | | DFS, 哈希表 | 3367 | [移除边后最大化权重和](https://leetcode.com/problems/maximize-sum-of-weights-after-edge-removals/)| [C++](./C++/maximize-sum-of-weights-after-edge-removals.cpp) [Python](./Python/maximize-sum-of-weights-after-edge-removals.py)| _O(n)_ | _O(n)_ | 困难 | | DFS, 快速选择 | 3590 | [第 K 小路径异或和](https://leetcode.com/problems/kth-smallest-path-xor-sum/)| [C++](./C++/kth-smallest-path-xor-sum.cpp) [Python](./Python/kth-smallest-path-xor-sum.py)| _O(n * (logn)^2 + qlogn)_ | _O(n + q)_ | 困难 | | DFS, 启发式合并, 有序集合, 有序列表 | 3593 | [使叶节点路径相等的最小增量](https://leetcode.com/problems/minimum-increments-to-equalize-leaf-paths/)| [C++](./C++/minimum-increments-to-equalize-leaf-paths.cpp) [Python](./Python/minimum-increments-to-equalize-leaf-paths.py)| _O(n)_ | _O(n)_ | 中等 | | DFS | 3607 | [电网维护](https://leetcode.com/problems/power-grid-maintenance/)| [C++](./C++/power-grid-maintenance.cpp) [Python](./Python/power-grid-maintenance.py)| _O(c + n + q)_ | _O(c + n)_ | 中等 | | DFS, 泛洪填充, 排序 |

## 回溯 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3211 | [生成不含相邻零的二进制字符串](https://leetcode.com/problems/generate-binary-strings-without-adjacent-zeros/) | [C++](./C++/generate-binary-strings-without-adjacent-zeros.cpp) [Python](./Python/generate-binary-strings-without-adjacent-zeros.py) | _O(n * 2^n)_ | _O(n)_ | 中等 | | 回溯, BFS 3437 | [全排列 III](https://leetcode.com/problems/permutations-iii/) | [C++](./C++/permutations-iii.cpp) [Python](./Python/permutations-iii.py) | _O(n * n!)_ | _O(n)_ | 中等 | 🔒 | 回溯, 位运算 3565 | [顺序网格路径覆盖](https://leetcode.com/problems/sequential-grid-path-cover/) | [C++](./C++/sequential-grid-path-cover.cpp) [Python](./Python/sequential-grid-path-cover.py) | _O(m * n * 3^(m * n))_ | _O(m * n)_ | 中等 | 🔒 | 回溯 3669 | [平衡 K 因子分解](https://leetcode.com/problems/balanced-k-factor-decomposition/) | [C++](./C++/balanced-k-factor-decomposition.cpp) [Python](./Python/balanced-k-factor-decomposition.py) | 预计算: _O(rlogr)_
运行时: _O(k * (logn)^(k - 1))_ | _O(rlogr)_ | 中等 | | 回溯, 数论

## 动态规划 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3018 | [可处理的最大移除查询数 I](https://leetcode.com/problems/maximum-number-of-removal-queries-that-can-be-processed-i/) | [C++](./C++/maximum-number-of-removal-queries-that-can-be-processed-i.cpp) [Python](./Python/maximum-number-of-removal-queries-that-can-be-processed-i.py) | _O(n^2)_ | _O(n^2)_ | 困难 | 🔒 | 动态规划 3020 | [求子集中的最大元素数](https://leetcode.com/problems/find-the-maximum-number-of-elements-in-subset/) | [C++](./C++/find-the-maximum-number-of-elements-in-subset.cpp) [Python](./Python/find-the-maximum-number-of-elements-in-subset.py) | _O(n)_ | _O(n)_ | 中等 || 频率表, 动态规划 3040 | [相同分数的最大操作数 II](https://leetcode.com/problems/maximum-number-of-operations-with-the-same-score-ii/) | [C++](./C++/maximum-number-of-operations-with-the-same-score-ii.cpp) [Python](./Python/maximum-number-of-operations-with-the-same-score-ii.py) | _O(n^2)_ | _O(n^2)_ | 中等 | | 记忆化搜索 3041 | [修改后最大化数组中的连续元素](https://leetcode.com/problems/maximize-consecutive-elements-in-an-array-after-modification/) | [C++](./C++/maximize-consecutive-elements-in-an-array-after-modification.cpp) [Python](./Python/maximize-consecutive-elements-in-an-array-after-modification.py) | _O(nlogn)_ | _O(1)_ | 困难 | | 排序, 动态规划 3077 | [K 个不相交子数组的最大强度](https://leetcode.com/problems/maximum-strength-of-k-disjoint-subarrays/) | [C++](./C++/maximum-strength-of-k-disjoint-subarrays.cpp) [Python](./Python/maximum-strength-of-k-disjoint-subarrays.py) | _O(k * n)_ | _O(n)_ | 困难 | | 动态规划, 贪心, `Kadane 算法` 3082 | [求所有子序列的幂的和](https://leetcode.com/problems/find-the-sum-of-the-power-of-all-subsequences/) | [C++](./C++/find-the-sum-of-the-power-of-all-subsequences.cpp) [Python](./Python/find-the-sum-of-the-power-of-all-subsequences.py) | _O(n * k)_ | _O(k)_ |困难 | | 动态规划, 组合数学 3098 | [求子序列的幂和](https://leetcode.com/problems/find-the-sum-of-subsequence-powers/) | [C++](./C++/find-the-sum-of-subsequence-powers.cpp) [Python](./Python/find-the-sum-of-subsequence-powers.py) | _O(n^3 * k)_ | _O(n^2)_ | 困难 | | 动态规划, 前缀和, 双指针 3101 | [统计交替子数组](https://leetcode.com/problems/count-alternating-subarrays/) | [C++](./C++/count-alternating-subarrays.cpp) [Python](./Python/count-alternating-subarrays.py) | _O(n)_ | _O(1)_ | 中等 | | 动态规划 3117 | [通过划分数组求值的最小和](https://leetcode.com/problems/minimum-sum-of-values-by-dividing-array/) | [C++](./C++/minimum-sum-of-values-by-dividing-array.cpp) [Python](./Python/minimum-sum-of-values-by-dividing-array.py) | _O(n * m * logr)_ | _O(n + logr)_ | 困难 | | 记忆化搜索, 动态规划, RMQ, 稀疏表, 单调双端队列, 双指针 3122 | [使条件满足的最少操作数](https://leetcode.com/problems/minimum-number-of-operations-to-satisfy-conditions/) | [C++](./C++/minimum-number-of-operations-to-satisfy-conditions.cpp) [Python](./Python/minimum-number-of-operations-to-satisfy-conditions.py) | _O(n * (m + 10))_ | _O(10)_ | 中等 | | 动态规划 3129 | [查找所有可能的稳定二进制数组 I](https://leetcode.com/problems/find-all-possible-stable-binary-arrays-i/) | [C++](./C++/find-all-possible-stable-binary-arrays-i.cpp) [Python](./Python/find-all-possible-stable-binary-arrays-i.py) | _O(n * m)_ | _O(n * m)_ | 中等 | | 动态规划 3130 | [查找所有可能的稳定二进制数组 II](https://leetcode.com/problems/find-all-possible-stable-binary-arrays-ii/) | [C++](./C++/find-all-possible-stable-binary-arrays-ii.cpp) [Python](./Python/find-all-possible-stable-binary-arrays-ii.py) | _O(n * m)_ | _O(n * m)_ | 困难 | | 动态规划 3141 | [最大汉明距离](https://leetcode.com/problems/maximum-hamming-distances/)| [C++](./C++/maximum-hamming-distances.cpp) [Python](./Python/maximum-hamming-distances.py)| _O(m * 2^m)_ | _O(2^m)_ | 困难 | 🔒 | 位运算, BFS, 背包动态规划 | 3144 | [相等字符频率的最小子串划分](https://leetcode.com/problems/minimum-substring-partition-of-equal-character-frequency/) | [C++](./C++/minimum-substring-partition-of-equal-character-frequency.cpp) [Python](./Python/minimum-substring-partition-of-equal-character-frequency.py) | _O(n * (n + 26))_ | _O(n + 26)_ | 中等 | | 动态规划, 频率表 3148 | [网格中的最大差值分数](https://leetcode.com/problems/maximum-difference-score-in-a-grid/) | [C++](./C++/maximum-difference-score-in-a-grid.cpp) [Python](./Python/maximum-difference-score-in-a-grid.py) | _O(m * n)_ | _O(1)_ | 中等 | | 动态规划 3149 | [求数组排列的最小成本](https://leetcode.com/problems/find-the-minimum-cost-array-permutation/) | [C++](./C++/find-the-minimum-cost-array-permutation.cpp) [Python](./Python/find-the-minimum-cost-array-permutation.py) | _O((n-1)^2 * 2^(n-1))_ | _O((n-1) * 2^(n-1))_ | 困难 | | 动态规划, 回溯 3176 | [求好子序列的最大长度 I](https://leetcode.com/problems/find-the-maximum-length-of-a-good-subsequence-i/) | [C++](./C++/find-the-maximum-length-of-a-good-subsequence-i.cpp) [Python](./Python/find-the-maximum-length-of-a-good-subsequence-i.py) | _O(n * k)_ | _O(n * k)_ | 中等 | | 动态规划 3177 | [求好子序列的最大长度 II](https://leetcode.com/problems/find-the-maximum-length-of-a-good-subsequence-ii/) | [C++](./C++/find-the-maximum-length-of-a-good-subsequence-ii.cpp) [Python](./Python/find-the-maximum-length-of-a-good-subsequence-ii.py) | _O(n * k)_ | _O(n * k)_ | 困难 | | 动态规划 3180 | [使用操作 I 获得的最大总奖励](https://leetcode.com/problems/maximum-total-reward-using-operations-i/) | [C++](./C++/maximum-total-reward-using-operations-i.cpp) [Python](./Python/maximum-total-reward-using-operations-i.py) | _O(n * k)_ | _O(n * k)_ | 中等 | | 排序, 动态规划, 位集 3181 | [使用操作 II 获得的最大总奖励](https://leetcode.com/problems/maximum-total-reward-using-operations-ii/) | [C++](./C++/maximum-total-reward-using-operations-ii.cpp) [Python]( 3074 | [将 Apple 重新分配到箱子中](https://leetcode.com/problems/apple-redistribution-into-boxes/) | [C++](./C++/apple-redistribution-into-boxes.cpp) [Python](./Python/apple-redistribution-into-boxes.py) | _O(nlogn)_ | _O(1)_ | 简单 | | Sort, Greedy 3075 | [最大化所选孩子的快乐值](https://leetcode.com/problems/maximize-happiness-of-selected-children/) | [C++](./C++/maximize-happiness-of-selected-children.cpp) [Python](./Python/maximize-happiness-of-selected-children.py) | _O(nlogn)_ | _O(1)_ | 中等 | | Sort, Greedy 3086 | [拾起 K 个 1 的最少移动次数](https://leetcode.com/problems/minimum-moves-to-pick-k-ones/) | [C++](./C++/minimum-moves-to-pick-k-ones.cpp) [Python](./Python/minimum-moves-to-pick-k-ones.py) | _O(n)_ | _O(n)_ | 困难 | | Prefix Sum, Greedy 3088 | [使字符串成为反回文串](https://leetcode.com/problems/make-string-anti-palindrome/) | [C++](./C++/make-string-anti-palindrome.cpp) [Python](./Python/make-string-anti-palindrome.py) | _O(n + 26)_ | _O(26)_ | 困难 | 🔒 | Freq Table, Counting Sort, Greedy, Two Pointers 3106 | [带约束操作后的字典序最小字符串](https://leetcode.com/problems/lexicographically-smallest-string-after-operations-with-constraint/) | [C++](./C++/lexicographically-smallest-string-after-operations-with-constraint.cpp) [Python](./Python/lexicographically-smallest-string-after-operations-with-constraint.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3107 | [使数组中位数等于 K 的最少操作次数](https://leetcode.com/problems/minimum-operations-to-make-median-of-array-equal-to-k/) | [C++](./C++/minimum-operations-to-make-median-of-array-equal-to-k.cpp) [Python](./Python/minimum-operations-to-make-median-of-array-equal-to-k.py) | _O(n)_ | _O(1)_ | 中等 | | Sort, Quick Select, Greedy 3111 | [覆盖点的最少矩形数量](https://leetcode.com/problems/minimum-rectangles-to-cover-points/) | [C++](./C++/minimum-rectangles-to-cover-points.cpp) [Python](./Python/minimum-rectangles-to-cover-points.py) | _O(nlogn)_ | _O(n)_ | 中等 | | Sort, Greedy 3114 | [替换字符后可以得到的最新时间](https://leetcode.com/problems/latest-time-you-can-obtain-after-replacing-characters/)| [C++](./C++/latest-time-you-can-obtain-after-replacing-characters.cpp) [Python](./Python/latest-time-you-can-obtain-after-replacing-characters.py)| _O(1)_ | _O(1)_ | 简单 | | String, Greedy | 3119 | [可以修复的坑洞最大数量](https://leetcode.com/problems/maximum-number-of-potholes-that-can-be-fixed/)| [C++](./C++/maximum-number-of-potholes-that-can-be-fixed.cpp) [Python](./Python/maximum-number-of-potholes-that-can-be-fixed.py)| _O(n)_ | _O(n)_ | 中等 | 🔒 | Sort, Counting Sort, Greedy | 3170 | [移除星号后的字典序最小字符串](https://leetcode.com/problems/lexicographically-minimum-string-after-removing-stars/)| [C++](./C++/lexicographically-minimum-string-after-removing-stars.cpp) [Python](./Python/lexicographically-minimum-string-after-removing-stars.py)| _O(n + 26)_ | _O(n + 26)_ | 中等 | | Greedy, Hash Table, Stack | 3189 | [得到一个和平棋盘的最少移动次数](https://leetcode.com/problems/minimum-moves-to-get-a-peaceful-board/) | [C++](./C++/minimum-moves-to-get-a-peaceful-board.cpp) [Python](./Python/minimum-moves-to-get-a-peaceful-board.py) | _O(n)_ | _O(n)_ | 中等 | 🔒, [在二叉树中分配硬币](https://leetcode.com/problems/distribute-coins-in-binary-tree/) 的变体 | Counting Sort, Prefix Sum, Greedy 3191 | [使二进制数组元素等于 1 的最少操作次数 I](https://leetcode.com/problems/minimum-operations-to-make-binary-array-elements-equal-to-one-i/) | [C++](./C++/minimum-operations-to-make-binary-array-elements-equal-to-one-i.cpp) [Python](./Python/minimum-operations-to-make-binary-array-elements-equal-to-one-i.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3192 | [使二进制数组元素等于 1 的最少操作次数 II](https://leetcode.com/problems/minimum-operations-to-make-binary-array-elements-equal-to-one-ii/) | [C++](./C++/minimum-operations-to-make-binary-array-elements-equal-to-one-ii.cpp) [Python](./Python/minimum-operations-to-make-binary-array-elements-equal-to-one-ii.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3205 | [最大数组跳跃得分 I](https://leetcode.com/problems/maximum-array-hopping-score-i/)| [C++](./C++/maximum-array-hopping-score-i.cpp) [Python](./Python/maximum-array-hopping-score-i.py)| _O(n)_ | _O(1)_ | 中等 | 🔒 | DP, Prefix Sum, Greedy | 3207 | [敌人战斗后的最大得分](https://leetcode.com/problems/maximum-points-after-enemy-battles/)| [C++](./C++/maximum-points-after-enemy-battles.cpp) [Python](./Python/maximum-points-after-enemy-battles.py)| _O(n)_ | _O(1)_ | 中等 | | Greedy | 3216 | [交换后的字典序最小字符串](https://leetcode.com/problems/lexicographically-smallest-string-after-a-swap/)| [C++](./C++/lexicographically-smallest-string-after-a-swap.cpp) [Python](./Python/lexicographically-smallest-string-after-a-swap.py)| _O(n)_ | _O(1)_ | 简单 | | Greedy | 3218 | [切蛋糕的最小成本 I](https://leetcode.com/problems/minimum-cost-for-cutting-cake-i/)| [C++](./C++/minimum-cost-for-cutting-cake-i.cpp) [Python](./Python/minimum-cost-for-cutting-cake-i.py)| _O(mlogm + nlogn)_ | _O(1)_ | 中等 | | Memoization, Greedy | 3219 | [切蛋糕的最小成本 II](https://leetcode.com/problems/minimum-cost-for-cutting-cake-ii/)| [C++](./C++/minimum-cost-for-cutting-cake-ii.cpp) [Python](./Python/minimum-cost-for-cutting-cake-ii.py)| _O(mlogm + nlogn)_ | _O(1)_ | 困难 | | Greedy | 3221 | [最大数组跳跃得分 II](https://leetcode.com/problems/maximum-array-hopping-score-ii/)| [C++](./C++/maximum-array-hopping-score-ii.cpp) [Python](./Python/maximum-array-hopping-score-ii.py)| _O(n)_ | _O(1)_ | 中等 | 🔒 | Prefix Sum, Greedy | 3228 | [将 1 移动到末尾的最大操作数](https://leetcode.com/problems/maximum-number-of-operations-to-move-ones-to-the-end/)| [C++](./C++/maximum-number-of-operations-to-move-ones-to-the-end.cpp) [Python](./Python/maximum-number-of-operations-to-move-ones-to-the-end.py)| _O(n)_ | _O(1)_ | 中等 | | Greedy | 3229 | [使数组等于目标数组的最少操作次数](https://leetcode.com/problems/minimum-operations-to-make-array-equal-to-target/)| [C++](./C++/minimum-operations-to-make-array-equal-to-target.cpp) [Python](./Python/minimum-operations-to-make-array-equal-to-target.py)| _O(n)_ | _O(1)_ | 困难 | [形成目标数组所需的子数组最少递增次数](https://leetcode.com/problems/minimum-number-of-increments-on-subarrays-to-form-a-target-array/) 的变体 | Greedy | 3239 | [使二进制矩阵成为回文矩阵的最少翻转次数 I](https://leetcode.com/problems/minimum-number-of-flips-to-make-binary-grid-palindromic-i/) | [C++](./C++/minimum-number-of-flips-to-make-binary-grid-palindromic-i.cpp) [Python](./Python/minimum-number-of-flips-to-make-binary-grid-palindromic-i.py) | _O(m * n)_ | _O(1)_ | 中等 | | Array, Greedy 3240 | [使二进制矩阵成为回文矩阵的最少翻转次数 II](https://leetcode.com/problems/minimum-number-of-flips-to-make-binary-grid-palindromic-ii/) | [C++](./C++/minimum-number-of-flips-to-make-binary-grid-palindromic-ii.cpp) [Python](./Python/minimum-number-of-flips-to-make-binary-grid-palindromic-ii.py) | _O(m * n)_ | _O(1)_ | 中等 | | Array, Greedy 3273 | [对 Bob 造成的最少伤害](https://leetcode.com/problems/minimum-amount-of-damage-dealt-to-bob/) | [C++](./C++/minimum-amount-of-damage-dealt-to-bob.cpp) [Python](./Python/minimum-amount-of-damage-dealt-to-bob.py) | _O(nlogn)_ | _O(n)_ | 困难 | | Sort, Greedy 3282 | [到达数组末尾的最大得分](https://leetcode.com/problems/reach-end-of-array-with-max-score/) | [C++](./C++/reach-end-of-array-with-max-score.cpp) [Python](./Python/reach-end-of-array-with-max-score.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3301 | [最大化独立塔楼的总高度](https://leetcode.com/problems/maximize-the-total-height-of-unique-towers/) | [C++](./C++/maximize-the-total-height-of-unique-towers.cpp) [Python](./Python/maximize-the-total-height-of-unique-towers.py) | _O(nlogn)_ | _O(1)_ | 中等 | | Sort, Greedy 3302 | [找到字典序最小的有效序列](https://leetcode.com/problems/find-the-lexicographically-smallest-valid-sequence/) | [C++](./C++/find-the-lexicographically-smallest-valid-sequence.cpp) [Python](./Python/find-the-lexicographically-smallest-valid-sequence.py) | _O(n + m)_ | _O(m)_ | 中等 | | Hash Table, Greedy 3362 | [零数组变换 III](https://leetcode.com/problems/zero-array-transformation-iii/) | [C++](./C++/zero-array-transformation-iii.cpp) [Python](./Python/zero-array-transformation-iii.py) | _O(n + qlogq)_ | _O(q)_ | 中等 | | Sort, Heap, Greedy 3397 | [操作后不同元素的最大数量](https://leetcode.com/problems/maximum-number-of-distinct-elements-after-operations/) | [C++](./C++/maximum-number-of-distinct-elements-after-operations.cpp) [Python](./Python/maximum-number-of-distinct-elements-after-operations.py) | _O(nlogn)_ | _O(1)_ | 中等 | | Sort, Greedy 3402 | [使列严格递增的最少操作次数](https://leetcode.com/problems/minimum-operations-to-make-columns-strictly-increasing/) | [C++](./C++/minimum-operations-to-make-columns-strictly-increasing.cpp) [Python](./Python/minimum-operations-to-make-columns-strictly-increasing.py) | _O(m * n)_ | _O(1)_ | 简单 | | Greedy 3403 | [从盒子中找出字典序最大的字符串 I](https://leetcode.com/problems/find-the-lexicographically-largest-string-from-the-box-i/) | [C++](./C++/find-the-lexicographically-largest-string-from-the-box-i.cpp) [Python](./Python/find-the-lexicographically-largest-string-from-the-box-i.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3406 | [从盒子中找出字典序最大的字符串 II](https://leetcode.com/problems/find-the-lexicographically-largest-string-from-the-box-ii/) | [C++](./C++/find-the-lexicographically-largest-string-from-the-box-ii.cpp) [Python](./Python/find-the-lexicographically-largest-string-from-the-box-ii.py) | _O(n)_ | _O(1)_ | 困难 | 🔒 | Greedy 3410 | [移除所有出现的元素后最大化子数组和](https://leetcode.com/problems/maximize-subarray-sum-after-removing-all-occurrences-of-one-element/) | [C++](./C++/maximize-subarray-sum-after-removing-all-occurrences-of-one-element.cpp) [Python](./Python/maximize-subarray-sum-after-removing-all-occurrences-of-one-element.py) | _O(n)_ | _O(n)_ | 困难 | | Prefix Sum, Greedy, `Kadane's Algorithm`, Segment Tree 3424 | [使数组相同的最小成本](https://leetcode.com/problems/minimum-cost-to-make-arrays-identical/) | [C++](./C++/minimum-cost-to-make-arrays-identical.cpp) [Python](./Python/minimum-cost-to-make-arrays-identical.py) | _O(nlogn)_ | _O(1)_ | 中等 | | Sort, Greedy 3443 | [K 次修改后的最大曼哈顿距离](https://leetcode.com/problems/maximum-manhattan-distance-after-k-changes/) | [C++](./C++/maximum-manhattan-distance-after-k-changes.cpp) [Python](./Python/maximum-manhattan-distance-after-k-changes.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3457 | [吃披萨!](https://leetcode.com/problems/eat-pizzas/) | [C++](./C++/eat-pizzas.cpp) [Python](./Python/eat-pizzas.py) | _O(nlogn)_ | _O(1)_ | 中等 | | Sort, Greedy 3458 | [选择 K 个不相交的特殊子字符串](https://leetcode.com/problems/select-k-disjoint-special-substrings/) | [C++](./C++/select-k-disjoint-special-substrings.cpp) [Python](./Python/select-k-disjoint-special-substrings.py) | _O(n + 26^3)_ | _O(26)_ | 中等 | | Hash Table, Sort, Greedy 3462 | [最多 K 个元素的最大和](https://leetcode.com/problems/maximum-sum-with-at-most-k-elements/) | [C++](./C++/maximum-sum-with-at-most-k-elements.cpp) [Python](./Python/maximum-sum-with-at-most-k-elements.py) | _O(n * m)_ | _O(1)_ | 中等 | | Greedy, Quick Select 3468 | [找出副本数组的数量](https://leetcode.com/problems/find-the-number-of-copy-arrays/) | [C++](./C++/find-the-number-of-copy-arrays.cpp) [Python](./Python/find-the-number-of-copy-arrays.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3474 | [字典序最小的生成字符串](https://leetcode.com/problems/lexicographically-smallest-generated-string/) | [C++](./C++/lexicographically-smallest-generated-string.cpp) [Python](./Python/lexicographically-smallest-generated-string.py) | _O(n + m)_ | _O(n + m)_ | 困难 | | `KMP Algorithm`, `Z-Function`, Two Pointers, Sliding Window, Deque, Greedy 3476 | [最大化任务分配的利润](https://leetcode.com/problems/maximize-profit-from-task-assignment/) | [C++](./C++/maximize-profit-from-task-assignment.cpp) [Python](./Python/maximize-profit-from-task-assignment.py) | _O(n + tlogt)_ | _O(n)_ | 中等 | 🔒 | Freq Table, Sort, Greedy 3478 | [选择 K 个元素使它们的和最大](https://leetcode.com/problems/choose-k-elements-with-maximum-sum/) | [C++](./C++/choose-k-elements-with-maximum-sum.cpp) [Python](./Python/choose-k-elements-with-maximum-sum.py) | _O(nlogn)_ | _O(n)_ | 中等 | | Sort, Greedy, Two Pointers, Heap 3480 [移除一对冲突元素后最大化子数组数量](https://leetcode.com/problems/maximize-subarrays-after-removing-one-conflicting-pair/) | [C++](./C++/maximize-subarrays-after-removing-one-conflicting-pair.cpp) [Python](./Python/maximize-subarrays-after-removing-one-conflicting-pair.py) | _O(n + m)_ | _O(n + m)_ | 困难 | | Greedy 3494 | [制作魔药的最短时间](https://leetcode.com/problems/find-the-minimum-amount-of-time-to-brew-potions/) | [C++](./C++/find-the-minimum-amount-of-time-to-brew-potions.cpp) [Python](./Python/find-the-minimum-amount-of-time-to-brew-potions.py) | _O(n * m)_ | _O(1)_ | 中等 | | Prefix Sum, Greedy 3494 | [制作魔药的最短时间](https://leetcode.com/problems/find-the-minimum-amount-of-time-to-brew-potions/) | [C++](./C++/find-the-minimum-amount-of-time-to-brew-potions.cpp) [Python](./Python/find-the-minimum-amount-of-time-to-brew-potions.py) | _O(n * m)_ | _O(1)_ | 中等 | | Prefix Sum, Greedy 3495 | [使数组元素变为 0 的最少操作次数](https://leetcode.com/problems/minimum-operations-to-make-array-elements-zero/) | [C++](./C++/minimum-operations-to-make-array-elements-zero.cpp) [Python](./Python/minimum-operations-to-make-array-elements-zero.py) | _O(qlogr)_ | _O(1)_ | 困难 | | Greedy 3496 | [删除数对后的最大得分](https://leetcode.com/problems/maximize-score-after-pair-deletions/) | [C++](./C++/maximize-score-after-pair-deletions.cpp) [Python](./Python/maximize-score-after-pair-deletions.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | Greedy 3499 | [交易后的最大激活部分 I](https://leetcode.com/problems/maximize-active-section-with-trade-i/) | [C++](./C++/maximize-active-section-with-trade-i.cpp) [Python](./Python/maximize-active-section-with-trade-i.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3501 | [交易后的最大激活部分 II](https://leetcode.com/problems/maximize-active-section-with-trade-ii/) | [C++](./C++/maximize-active-section-with-trade-ii.cpp) [Python](./Python/maximize-active-section-with-trade-ii.py) | _O(nlogn + q)_ | _O(nlogn)_ | 困难 | | Greedy, RMQ, Sparse Table 3506 | [消除细菌菌株所需的时间](https://leetcode.com/problems/find-time-required-to-eliminate-bacterial-strains/) | [C++](./C++/find-time-required-to-eliminate-bacterial-strains.cpp) [Python](./Python/find-time-required-to-eliminate-bacterial-strains.py) | _O(nlogn)_ | _O(1)_ | 困难 | 🔒 | Heap, Greedy 3511 | [构造正数组](https://leetcode.com/problems/make-a-positive-array/) | [C++](./C++/make-a-positive-array.cpp) [Python](./Python/make-a-positive-array.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | Prefix Sum, Greedy 3517 | [最小回文重排 I](https://leetcode.com/problems/smallest-palindromic-rearrangement-i/) | [C++](./C++/smallest-palindromic-rearrangement-i.cpp) [Python](./Python/smallest-palindromic-rearrangement-i.py) | _O(n + 26)_ | _O(26)_ | 中等 | | Freq Table, Counting Sort, Greedy 3518 | [最小回文重排 II](https://leetcode.com/problems/smallest-palindromic-rearrangement-ii/) | [C++](./C++/smallest-palindromic-rearrangement-ii.cpp) [Python](./Python/smallest-palindromic-rearrangement-ii.py) | _O(26 * n)_ | _O(26)_ | 困难 | | Freq Table, Counting Sort, Greedy, Combinatorics 3523 | [使数组非递减](https://leetcode.com/problems/make-array-non-decreasing/) | [C++](./C++/make-array-non-decreasing.cpp) [Python](./Python/make-array-non-decreasing.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3542 | [将所有元素转换为 0 的最少操作次数](https://leetcode.com/problems/minimum-operations-to-convert-all-elements-to-zero/) | [C++](./C++/minimum-operations-to-convert-all-elements-to-zero.cpp) [Python](./Python/minimum-operations-to-convert-all-elements-to-zero.py) | _O(n)_ | _O(n)_ | 中等 | | Greedy, Mono Stack 3545 | [最多 K 个不同字符的最少删除次数](https://leetcode.com/problems/minimum-deletions-for-at-most-k-distinct-characters/) | [C++](./C++/minimum-deletions-for-at-most-k-distinct-characters.cpp) [Python](./Python/minimum-deletions-for-at-most-k-distinct-characters.py) | _O(n + 26)_ | _O(n + 26)_ | 简单 | | Freq Table, Counting Sort, Greedy 3557 | [找出最大数量的不相交子字符串](https://leetcode.com/problems/find-maximum-number-of-non-intersecting-substrings/) | [C++](./C++/find-maximum-number-of-non-intersecting-substrings.cpp) [Python](./Python/find-maximum-number-of-non-intersecting-substrings.py) | _O(n)_ | _O(26)_ | 中等 | | Greedy, Hash Table 3576 | [转换数组使所有元素相等](https://leetcode.com/problems/transform-array-to-all-equal-elements/) | [C++](./C++/transform-array-to-all-equal-elements.cpp) [Python](./Python/transform-array-to-all-equal-elements.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3587 | [交替奇偶性的最少相邻交换次数](https://leetcode.com/problems/minimum-adjacent-swaps-to-alternate-parity/) | [C++](./C++/minimum-adjacent-swaps-to-alternate-parity.cpp) [Python](./Python/minimum-adjacent-swaps-to-alternate-parity.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3627 | [大小为 3 的子序列的最大中位数之和](https://leetcode.com/problems/maximum-median-sum-of-subsequences-of-size-3/) | [C++](./C++/maximum-median-sum-of-subsequences-of-size-3.cpp) [Python](./Python/maximum-median-sum-of-subsequences-of-size-3.py) | _O(nlogn)_ | _O(1)_ | 中等 | | Sort, Greedy 3630 | [使 XOR 和 AND 最大的数组分区](https://leetcode.com/problems/partition-array-for-maximum-xor-and-and/) | [C++](./C++/partition-array-for-maximum-xor-and-and.cpp) [Python](./Python/partition-array-for-maximum-xor-and-and.py) | _O(nlogr * 2^n)_ | _O(1)_ | 困难 | | Bitmasks, Greedy 3633 | [陆地和水上滑行的最早完成时间 I](https://leetcode.com/problems/earliest-finish-time-for-land-and-water-rides-i/) | [C++](./C++/earliest-finish-time-for-land-and-water-rides-i.cpp) [Python](./Python/earliest-finish-time-for-land-and-water-rides-i.py) | _O(n)_ | _O(1)_ | 简单 | | Greedy 3635 | [陆地和水上滑行的最早完成时间 II](https://leetcode.com/problems/earliest-finish-time-for-land-and-water-rides-ii/) | [C++](./C++/earliest-finish-time-for-land-and-water-rides-ii.cpp) [Python](./Python/earliest-finish-time-for-land-and-water-rides-ii.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3638 | [最大平衡装运量](https://leetcode.com/problems/maximum-balanced-shipments/) | [C++](./C++/maximum-balanced-shipments.cpp) [Python](./Python/maximum-balanced-shipments.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3645 | [最优激活顺序的最大总值](https://leetcode.com/problems/maximum-total-from-optimal-activation-order/) | [C++](./C++/maximum-total-from-optimal-activation-order.cpp) [Python](./Python/maximum-total-from-optimal-activation-order.py) | _O(nlogn)_ | _O(n)_ | 中等 | | Sort, Greedy 3675 | [转换字符串的最少操作次数](https://leetcode.com/problems/minimum-operations-to-transform-string/) | [C++](./C++/minimum-operations-to-transform-string.cpp) [Python](./Python/minimum-operations-to-transform-string.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3681 | [子序列的最大异或值](https://leetcode.com/problems/maximum-xor-of-subsequences/) | [C++](./C++/maximum-xor-of-subsequences.cpp) [Python](./Python/maximum-xor-of-subsequences.py) | _O(nlogr)_ | _O(r)_ | 困难 | | Bitmasks, Greedy 3689 | [最大子数组值 I](https://leetcode.com/problems/maximum-total-subarray-value-i/) | [C++](./C++/maximum-total-subarray-value-i.cpp) [Python](./Python/maximum-total-subarray-value-i.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3711 | [没有负余额的最大交易数](https://leetcode.com/problems/maximum-transactions-without-negative-balance/) | [C++](./C++/maximum-transactions-without-negative-balance.cpp) [Python](./Python/maximum-transactions-without-negative-balance.py) | _O(nlogn)_ | _O(n)_ | 中等 | 🔒 | Greedy, Heap 3720 | [大于目标值的字典序最小排列](https://leetcode.com/problems/lexicographically-smallest-permutation-greater-than-target/) | [C++](./C++/lexicographically-smallest-permutation-greater-than-target.cpp) [Python](./Python/lexicographically-smallest-permutation-greater-than-target.py) | _O(25 * n)_ | _O(26)_ | 中等 | | Freq Table, Greedy 3723 | [最大化数字的平方和](https://leetcode.com/problems/maximize-sum-of-squares-of-digits/) | [C++](./C++/maximize-sum-of-squares-of-digits.cpp) [Python](./Python/maximize-sum-of-squares-of-digits.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3724 | [转换数组的最少操作次数](https://leetcode.com/problems/minimum-operations-to-transform-array/) | [C++](./C++/minimum-operations-to-transform-array.cpp) [Python](./Python/minimum-operations-to-transform-array.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3727 | [最大交替平方和](https://leetcode.com/problems/maximum-alternating-sum-of-squares/) | [C++](./C++/maximum-alternating-sum-of-squares.cpp) [Python](./Python/maximum-alternating-sum-of-squares.py) | _O(n)_ | _O(n)_ | 中等 | | Greedy, Sort, Quick Select 3730 | [跳跃消耗的最大卡路里](https://leetcode.com/problems/maximum-calories-burnt-from-jumps/) | [C++](./C++/maximum-calories-burnt-from-jumps.cpp) [Python](./Python/maximum-calories-burnt-from-jumps.py) | _O(nlogn)_ | _O(1)_ | 中等 | 🔒 | Greedy, Sort 3732 | [一次替换后三个元素的最大乘积](https://leetcode.com/problems/maximum-product-of-three-elements-after-one-replacement/) | [C++](./C++/maximum-product-of-three-elements-after-one-replacement.cpp) [Python](./Python/maximum-product-of-three-elements-after-one-replacement.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3734 | [大于目标值的字典序最小回文排列](https://leetcode.com/problems/lexicographically-smallest-palindromic-permutation-greater-than-target/) | [C++](./C++/lexicographically-smallest-palindromic-permutation-greater-than-target.cpp) [Python](./Python/lexicographically-smallest-palindromic-permutation-greater-than-target.py) | _O(26 * n)_ | _O(26)_ | 困难 | | Freq Table, Greedy 3752 | [求和为目标值的字典序最小取反排列](https://leetcode.com/problems/lexicographically-smallest-negated-permutation-that-sums-to-target/) | [C++](./C++/lexicographically-smallest-negated-permutation-that-sums-to-target.cpp) [Python](./Python/lexicographically-smallest-negated-permutation-that-sums-to-target.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy, Two Pointers 3763 | [带阈值约束的最大总和](https://leetcode.com/problems/maximum-total-sum-with-threshold-constraints/) | [C++](./C++/maximum-total-sum-with-threshold-constraints.cpp) [Python](./Python/maximum-total-sum-with-threshold-constraints.py) | _O(n)_ | _O(n)_ | 中等 | 🔒 | Sort, Counting Sort, Greedy 3767 | [选择 K 个任务后的最大得分](https://leetcode.com/problems/maximize-points-after-choosing-k-tasks/) | [C++](./C++/maximize-points-after-choosing-k-tasks.cpp) [Python](./Python/maximize-points-after-choosing-k-tasks.py) | _O(n)_ | _O(n)_ | 中等 | | Greedy, Sort, Quick Select 3776 | [平衡循环数组的最少移动次数](https://leetcode.com/problems/minimum-moves-to-balance-circular-array/) | [C++](./C++/minimum-moves-to-balance-circular-array.cpp) [Python](./Python/minimum-moves-to-balance-circular-array.py) | _O(n)_ | _O(1)_ | 中等 | | Greedy 3785 | [避免禁止值的最少交换次数](https://leetcode.com/problems/minimum-swaps-to-avoid-forbidden-values/) | [C++](./C++/minimum-swaps-to-avoid-forbidden-values.cpp) [Python](./Python/minimum-swaps-to-avoid-forbidden-values.py) | _O(n)_ | _O(1)_ | 困难 | | `Boyer–Moore Majority Vote Algorithm`, Freq Table, Greedy 3796 | [在受限制的序列中找出最大值](https://leetcode.com/problems/find-maximum-value-in-a-constrained-sequence/) | [C++](./C++/find-maximum-value-in-a-constrained-sequence.cpp) [Python](./Python/find-maximum-value-in-a-constrained-sequence.py) | _O(n)_ | _O(n)_ | 中等 | | Greedy, DP 3797 | [计算爬矩形网格的路线数](https://leetcode.com/problems/count-routes-to-climb-a-rectangular-grid/) | [C++](./C++/count-routes-to-climb-a-rectangular-grid.cpp) [Python](./Python/count-routes-to-climb-a-rectangular-grid.py) | _O(n * m)_ | _O(m)_ | 困难 | | DP, Two Pointers 3806 | [自增操作后的最大按位与](https://leetcode.com/problems/maximum-bitwise-and-after-increment-operations/) | [C++](./C++/maximum-bitwise-and-after-increment-operations.cpp) [Python](
## 图 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3108 | [加权图中的最小成本路径](https://leetcode.com/problems/minimum-cost-walk-in-weighted-graph/) | [C++](./C++/minimum-cost-walk-in-weighted-graph.cpp) [Python](./Python/minimum-cost-walk-in-weighted-graph.py) | _O(n + e + q)_ | _O(n)_ | 困难 | | Union Find 3112 | [访问消失节点的最少时间](https://leetcode.com/problems/find-the-closest-marked-node/) | [C++](./C++/minimum-time-to-visit-disappearing-nodes.cpp) [Python](./Python/minimum-time-to-visit-disappearing-nodes.py) | _O(\|E\| * log\|V\|)_ | _O(\|E\|)_ | 中等 | | Graph, `Dijkstra's Algorithm` | 3123 | [找出最短路径中的边](https://leetcode.com/problems/find-edges-in-shortest-paths/) | [C++](./C++/find-edges-in-shortest-paths.cpp) [Python](./Python/find-edges-in-shortest-paths.py) | _O(\|E\| * log\|V\|)_ | _O(\|E\|)_ | 困难 | | Graph, `Dijkstra's Algorithm` | 3235 | [检查矩形角是否可达](https://leetcode.com/problems/check-if-the-rectangle-corner-is-reachable/) | [C++](./C++/check-if-the-rectangle-corner-is-reachable.cpp) [Python](./Python/check-if-the-rectangle-corner-is-reachable.py) | _O(n^2)_ | _O(n)_ | 困难 | | Graph, BFS, DFS, Union Find | 3243 | [添加道路查询后的最短距离 I](https://leetcode.com/problems/shortest-distance-after-road-addition-queries-i/) | [C++](./C++/shortest-distance-after-road-addition-queries-i.cpp) [Python](./Python/shortest-distance-after-road-addition-queries-i.py) | _O(n^2)_ | _O(n^2)_ | 中等 | | Graph, `Dijkstra's Algorithm`, BFS | 3244 | [添加道路查询后的最短距离 II](https://leetcode.com/problems/shortest-distance-after-road-addition-queries-ii/) | [C++](./C++/shortest-distance-after-road-addition-queries-ii.cpp) [Python](./Python/shortest-distance-after-road-addition-queries-ii.py) | _O(nlogn)_ | _O(n)_ | 困难 | | Graph, BST, Sorted List | 3265 | [统计几乎相等数对 I](https://leetcode.com/problems/count-almost-equal-pairs-i/) | [C++](./C++/count-almost-equal-pairs-i.cpp) [Python](./Python/count-almost-equal-pairs-i.py) | _O(n * l^2)_ | _O(n)_ | 中等 | | Freq Table, Combinatorics, Graph, BFS | 3267 | [统计几乎相等数对 II](https://leetcode.com/problems/count-almost-equal-pairs-ii/) | [C++](./C++/count-almost-equal-pairs-ii.cpp) [Python](./Python/count-almost-equal-pairs-ii.py) | _O(n * l^4)_ | _O(n)_ | 困难 | | Freq Table, Combinatorics, Graph, BFS | 3276 | [在网格中选择单元格以获得最大得分](https://leetcode.com/problems/select-cells-in-grid-with-maximum-score/) | [C++](./C++/select-cells-in-grid-with-maximum-score.cpp) [Python](./Python/select-cells-in-grid-with-maximum-score.py) | _O(n^2 * max(n, r))_ | _O(n * max(n, r))_ | 困难 | [最大兼容性评分和](https://leetcode.com/problems/maximum-compatibility-score-sum/) 的变体 | `Hungarian Weighted Bipartite Matching`, DP, Bitmasks | 3310 | [从项目中移除方法](https://leetcode.com/problems/remove-methods-from-project/)| [C++](./C++/remove-methods-from-project.cpp) [Python](./Python/remove-methods-from-project.py)| _O(n + e)_ | _O(n + e)_ | 中等 | | Graph, BFS | 3341 | [找到到达最后房间 I 的最短时间](https://leetcode.com/problems/find-minimum-time-to-reach-last-room-i/) | [C++](./C++/find-minimum-time-to-reach-last-room-i.cpp) [Python](./Python/find-minimum-time-to-reach-last-room-i.py) | _O(n * m * log(n * m))_ | _O(n * m)_ | 中等 | | Graph, `Dijkstra's Algorithm` | 3342 | [找到到达最后房间 II 的最短时间](https://leetcode.com/problems/find-minimum-time-to-reach-last-room-ii/) | [C++](./C++/find-minimum-time-to-reach-last-room-ii.cpp) [Python](./Python/find-minimum-time-to-reach-last-room-ii.py) | _O(n * m * log(n * m))_ | _O(n * m)_ | 中等 | | Graph, `Dijkstra's Algorithm` | 3377 | [使两个整数相等的数字操作](https://leetcode.com/problems/digit-operations-to-make-two-integers-equal/) | [C++](./C++/digit-operations-to-make-two-integers-equal.cpp) [Python](./Python/digit-operations-to-make-two-integers-equal.py) | _O(nlogn)_ | _O(n)_ | 中等 | | Graph, Number Theory, `Linear Sieve of Eratosthenes`, `Dijkstra's Algorithm` | 3378 | [统计 LCM 图中的连通分量数](https://leetcode.com/problems/count-connected-components-in-lcm-graph/) | [C++](./C++/count-connected-components-in-lcm-graph.cpp) [Python](./Python/count-connected-components-in-lcm-graph.py) | _O(n + tlogt)_ | _O(t)_ | 困难 | | Number Theory, Graph, Union Find | 3383 | [施放咒语需要添加的最少符文](https://leetcode.com/problems/minimum-runes-to-add-to-cast-spell/) | [C++](./C++/minimum-runes-to-add-to-cast-spell.cpp) [Python](./Python/minimum-runes-to-add-to-cast-spell.py) | _O(n)_ | _O(n)_ | 困难 | 🔒 | Graph, `Tarjan's Strongly Connected Components Algorithm`, SCC | 3376 | [开锁的最短时间 I](https://leetcode.com/problems/minimum-time-to-break-locks-i/) | [C++](./C++/minimum-time-to-break-locks-i.cpp) [Python](./Python/minimum-time-to-break-locks-i.py) | _O(n^3)_ | _O(n^2)_ | 中等 | | Bitmasks, DP, Graph, `Hungarian Weighted Bipartite Matching` 3385 | [开锁的最短时间 II](https://leetcode.com/problems/minimum-time-to-break-locks-ii/) | [C++](./C++/minimum-time-to-break-locks-ii.cpp) [Python](./Python/minimum-time-to-break-locks-ii.py) | _O(n^3)_ | _O(n^2)_ | 困难 | 🔒 | Graph, `Hungarian Weighted Bipartite Matching` 3387 | [两天兑换后的最大金额](https://leetcode.com/problems/maximize-amount-after-two-days-of-conversions/) | [C++](./C++/maximize-amount-after-two-days-of-conversions.cpp) [Python](./Python/maximize-amount-after-two-days-of-conversions.py) | _O(n^2)_ | _O(n)_ | 中等 | | `Bellman-Ford Algorithm`, BFS | 3419 | [最小化图的最大边权](https://leetcode.com/problems/minimize-the-maximum-edge-weight-of-graph/) | [C++](./C++/minimize-the-maximum-edge-weight-of-graph.cpp) [Python](./Python/minimize-the-maximum-edge-weight-of-graph.py) | _O(nlogn + e)_ | _O(n + e)_ | 中等 | | Graph, `Dijkstra's Algorithm`, `Prim's Algorithm`, Binary Search, BFS | 3435 | [最短超级序列的频率](https://leetcode.com/problems/frequencies-of-shortest-supersequences/) | [C++](./C++/frequencies-of-shortest-supersequences.cpp) [Python](./Python/frequencies-of-shortest-supersequences.py) | _O(n + k^2 * 2^k)_ | _O(k^2)_ | 困难 | | Bitmasks, Graph, Topological Sort | 3481 | [应用替换](https://leetcode.com/problems/apply-substitutions/) | [C++](./C++/apply-substitutions.cpp) [Python](./Python/apply-substitutions.py) | _O(r * 2^r)_ | _O(r * 2^r)_ | 中等 | 🔒 | Graph, Topological Sort, Memoization | 3493 | [属性图](https://leetcode.com/problems/properties-graph/) | [C++](./C++/properties-graph.cpp) [Python](./Python/properties-graph.py) | _O(n^2 * m)_ | _O(n)_ | 中等 | | Graph, Flood Fill, BFS, Union Find | 3532 | [图中的路径存在性查询 I](https://leetcode.com/problems/path-existence-queries-in-a-graph-i/) | [C++](./C++/path-existence-queries-in-a-graph-i.cpp) [Python](./Python/path-existence-queries-in-a-graph-i.py) | _O(n + q)_ | _O(n)_ | 中等 | | Prefix Sum 3534 | [图中的路径存在性查询 II](https://leetcode.com/problems/path-existence-queries-in-a-graph-ii/) | [C++](./C++/path-existence-queries-in-a-graph-ii.cpp) [Python](./Python/path-existence-queries-in-a-graph-ii.py) | _O((n + q) * logn)_ | _O(nlogn)_ | 困难 | | Prefix Sum, Greedy, Binary Lifting 3536 | [两个数字的最大乘积]() | [C++](./C++/maximum-product-of-two-digits.cpp) [Python](./Python/maximum-product-of-two-digits.py) | _O(d + 10)_ | _O(10)_ | 简单 | | Freq Table, Greedy 3547 | [图中边值的最大和](https://leetcode.com/problems/maximum-sum-of-edge-values-in-a-graph/) | [C++](./C++/maximum-sum-of-edge-values-in-a-graph.cpp) [Python](./Python/maximum-sum-of-edge-values-in-a-graph.py) | _O(n)_ | _O(n)_ | 困难 | | Flood Fill, BFS, Counting Sort, Greedy 3594 | [运送所有人的最少时间](https://leetcode.com/problems/minimum-time-to-transport-all-individuals/) | [C++](./C++/minimum-time-to-transport-all-individuals.cpp) [Python](./Python/minimum-time-to-transport-all-individuals.py) | _O(m * 3^n * log(m * 3^n))_ | _O(m * 3^n)_ | 困难 | | Graph, `Dijkstra's Algorithm`, Submask Enumeration 3600 | [通过升级最大化生成树稳定性](https://leetcode.com/problems/maximize-spanning-tree-stability-with-upgrades/) | [C++](./C++/maximize-spanning-tree-stability-with-upgrades.cpp) [Python](./Python/maximize-spanning-tree-stability-with-upgrades.py) | _O(n + eloge)_ | _O(n)_ | 困难 | | MST, Maximum Spanning Tree, Union Find, `Kruskal's Algorithm`, Greedy 3604 | [有向图中到达目的地的最短时间](https://leetcode.com/problems/minimum-time-to-reach-destination-in-directed-graph/) | [C++](./C++/minimum-time-to-reach-destination-in-directed-graph.cpp) [Python](./Python/minimum-time-to-reach-destination-in-directed-graph.py) | _O(n + elogn)_ | _O(n + e)_ | 中等 | | Graph, `Dijkstra's Algorithm` 3620 | [网络恢复路径](https://leetcode.com/problems/network-recovery-pathways/)|[C++](./C++/network-recovery-pathways.cpp) [Python](./Python/network-recovery-pathways.py) | _O((n + e) * logr)_ | _O(n + e)_ | 困难 | | Binary Search, Topological Sort, DP 3650 | [带边反转的最小成本路径](https://leetcode.com/problems/minimum-cost-path-with-edge-reversals/) | [C++](./C++/minimum-cost-path-with-edge-reversals.cpp) [Python](./Python/minimum-cost-path-with-edge-reversals.py) | _O(n + elogn)_ | _O(n + e)_ | 中等 | | Graph, `Dijkstra's Algorithm` 3656 | [判断简单图是否存在](https://leetcode.com/problems/determine-if-a-simple-graph-exists/) | [C++](./C++/determine-if-a-simple-graph-exists.cpp) [Python](./Python/determine-if-a-simple-graph-exists.py) | _O(nlogn)_ | _O(1)_ | 中等 | 🔒 | Graph, `Erdős–Gallai Theorem`, Sort, Prefix sum, Two Pointers 3660 | [跳跃游戏 IX](https://leetcode.com/problems/jump-game-ix/) | [C++](./C++/jump-game-ix.cpp) [Python](./Python/jump-game-ix.py) | _O(n)_ | _O(1)_ | 中等 | | Graph, Prefix Sum 3710 | [最大分区因子](https://leetcode.com/problems/maximum-partition-factor/) | [C++](./C++/maximum-partition-factor.cpp) [Python](./Python/maximum-partition-factor.py) | _O(n^2 * logn)_ | _O(n^2)_ | 困难 | | Graph, Sort, Coordinate Compression, Binary Search, BFS, Greedy, Union Find 3778 | [排除一条最大权重边的最小距离](https://leetcode.com/problems/minimum-distance-excluding-one-maximum-weighted-edge/) | [C++](./C++/minimum-distance-excluding-one-maximum-weighted-edge.cpp) [Python](./Python/minimum-distance-excluding-one-maximum-weighted-edge.py) | _O(n + elogn)_ | _O(n + e)_ | 中等 | 🔒 | Graph, `Dijkstra's Algorithm` 3873 | [一次添加激活的最大点数](https://leetcode.com/problems/maximum-points-activated-with-one-addition/) | [C++](./C++/maximum-points-activated-with-one-addition.cpp) [Python](./Python/maximum-points-activated-with-one-addition.py) | _O(n)_ | _O(n)_ | 困难 | | Graph, Union Find 3887 | [增量等权循环查询](https://leetcode.com/problems/incremental-even-weighted-cycle-queries/) | [C++](./C++/incremental-even-weighted-cycle-queries.cpp) [Python](./Python/incremental-even-weighted-cycle-queries.py) | _O(n + e)_ | _O(n)_ | 困难 | | Graph, Union Find 3910 | [统计节点之和为偶数的连通子图](https://leetcode.com/problems/count-connected-subgraphs-with-even-node-sum/) | [C++](./C++/count-connected-subgraphs-with-even-node-sum.cpp) [Python](./Python/count-connected-subgraphs-with-even-node-sum.py) | _O((n + e) * 2^n)_ | _O(n + e)_ | 困难 | | Graph, Bitmask, DFS

## 几何 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3453 | [分离正方形 I](https://leetcode.com/problems/separate-squares-i/) | [C++](./C++/separate-squares-i.cpp) [Python](./Python/separate-squares-i.py) | _O(nlogn)_ | _O(n)_ | 中等 | | Binary Search, Sort, Line Sweep 3454 | [分离正方形 II](https://leetcode.com/problems/separate-squares-ii/) | [C++](./C++/separate-squares-ii.cpp) [Python](./Python/separate-squares-ii.py) | _O(nlogn)_ | _O(n)_ | 困难 | | Sort, Line Sweep, Segment Tree

## 模拟 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3100 | [水瓶 II](https://leetcode.com/problems/water-bottles-ii/) | [C++](./C++/water-bottles-ii.cpp) [Python](./Python/water-bottles-ii.py) | _O(sqrt(n))_ | _O(1)_ | 中等 | | Simulation 3168 | [候诊室的最少椅子数](https://leetcode.com/problems/minimum-number-of-chairs-in-a-waiting-room/) | [C++](./C++/minimum-number-of-chairs-in-a-waiting-room.cpp) [Python](./Python/minimum-number-of-chairs-in-a-waiting-room.py) | _O(n)_ | _O(1)_ | 简单 | | Simulation 3175 | [找到第一个连续赢 K 场比赛的玩家](https://leetcode.com/problems/find-the-first-player-to-win-k-games-in-a-row/) | [C++](./C++/find-the-first-player-to-win-k-games-in-a-row.cpp) [Python](./Python/find-the-first-player-to-win-k-games-in-a-row.py) | _O(n)_ | _O(1)_ | 中等 | | Simulation 3248 | [矩阵中的蛇](https://leetcode.com/problems/snake-in-matrix/) | [C++](./C++/snake-in-matrix.cpp) [Python](./Python/snake-in-matrix.py) | _O(c)_ | _O(1)_ | 中等 | | Simulation 3412 | [计算字符串的镜像分数](https://leetcode.com/problems/find-mirror-score-of-a-string/) | [C++](./C++/find-mirror-score-of-a-string.cpp) [Python](./Python/find-mirror-score-of-a-string.py) | _O(n + 26)_ | _O(n + 26)_ | 中等 | | Simulation, Hash Table, Stack 3433 | [统计每个用户的提及次数](https://leetcode.com/problems/count-mentions-per-user/) | [C++](./C++/count-mentions-per-user.cpp) [Python](./Python/count-mentions-per-user.py) | _O(eloge + e * n)_ | _O(e + n)_ | 中等 | | Simulation 3507 | [使数组排序的最少数对删除 I](https://leetcode.com/problems/minimum-pair-removal-to-sort-array-i/) | [C++](./C++/minimum-pair-removal-to-sort-array-i.cpp) [Python](./Python/minimum-pair-removal-to-sort-array-i.py) | _O(nlogn)_ | _O(n)_ | 简单 | | Simulation, Doubly Linked List, Sorted List, BST 3510 | [使数组排序的最少数对删除 II](https://leetcode.com/problems/minimum-pair-removal-to-sort-array-ii/) | [C++](./C++/minimum-pair-removal-to-sort-array-ii.cpp) [Python](./Python/minimum-pair-removal-to-sort-array-ii.py) | _O(nlogn)_ | _O(n)_ | 困难 | | Simulation, Doubly Linked List, Sorted List, BST 3522 | [执行指令后的计算得分](https://leetcode.com/problems/calculate-score-after-performing-instructions/) | [C++](./C++/calculate-score-after-performing-instructions.cpp) [Python](./Python/calculate-score-after-performing-instructions.py) | _O(n)_ | _O(n)_ | 中等 | | Simulation 3561 | [相邻删除后的结果字符串](https://leetcode.com/problems/resulting-string-after-adjacent-removals/) | [C++](./C++/resulting-string-after-adjacent-removals.cpp) [Python](./Python/resulting-string-after-adjacent-removals.py) | _O(n)_ | _O(1)_ | 中等 | | Simulation, Stack 3597 | [分割字符串](https://leetcode.com/problems/partition-string/) | [C++](./C++/partition-string.cpp) [Python](./Python/partition-string.py) | _O(n)_ | _O(t)_ | 中等 | | Simulation, Trie 3608 | [K 个连通分量的最少时间](https://leetcode.com/problems/minimum-time-for-k-connected-components/) | [C++](./C++/minimum-time-for-k-connected-components.cpp) [Python](./Python/minimum-time-for-k-connected-components.py) | _O(n + eloge)_ | _O(n)_ | 中等 | | Backward Simulation, Sort, Union Find 3609 | [在网格中到达目标的最少移动次数](https://leetcode.com/problems/minimum-moves-to-reach-target-in-grid/) | [C++](./C++/minimum-moves-to-reach-target-in-grid.cpp) [Python](./Python/minimum-moves-to-reach-target-in-grid.py) | _O(logtx + logty)_ | _O(1)_ | 困难 | | Backward Simulation 3612 | [带特殊操作的字符串处理 I](https://leetcode.com/problems/process-string-with-special-operations-i/) | [C++](./C++/process-string-with-special-operations-i.cpp) [Python](./Python/process-string-with-special-operations-i.py) | _O(r)_ | _O(r)_ | 中等 | | Simulation, Deque 3613 | [最小化最大组件成本](https://leetcode.com/problems/minimize-maximum-component-cost/) | [C++](./C++/minimize-maximum-component-cost.cpp) [Python](./Python/minimize-maximum-component-cost.py) | _O(n + eloge)_ | _O(n)_ | 中等 | | Backward Simulation, Sort, Union Find 3614 | [带特殊操作的字符串处理 II](https://leetcode.com/problems/process-string-with-special-operations-ii/) | [C++](./C++/process-string-with-special-operations-ii.cpp) [Python](./Python/process-string-with-special-operations-ii.py) | _O(n)_ | _O(1)_ | 困难 | | Backward Simulation 3616 | [学生替换次数](https://leetcode.com/problems/number-of-student-replacements/) | [C++](./C++/number-of-student-replacements.cpp) [Python](./Python/number-of-student-replacements.py) | _O(n)_ | _O(1)_ | 中等 | 🔒 | Simulation 3639 | [激活字符串的最少时间](https://leetcode.com/problems/minimum-time-to-activate-string/) | [C++](./C++/minimum-time-to-activate-string.cpp) [Python](./Python/minimum-time-to-activate-string.py) | _O(n)_ | _O(n)_ | 中等 | | Backward Simulation, Doubly Linked List 3792 | [递增乘积块的和](https://leetcode.com/problems/sum-of-increasing-product-blocks/) | [C++](./C++/sum-of-increasing-product-blocks.cpp) [Python](./Python/sum-of-increasing-product-blocks.py) | _O(n^2)_ | _O(n^2)_ | 中等 | 🔒 | Simulation, Math 3847 | [找出游戏中的得分差](https://leetcode.com/problems/find-the-score-difference-in-a-game/) | [C++](./C++/find-the-score-difference-in-a-game.cpp) [Python](./Python/find-the-score-difference-in-a-game.py) | _O(n)_ | _O(1)_ | 中等 | | Simulation 3853 | [合并相邻字符](https://leetcode.com/problems/merge-close-characters/) | [C++](./C++/merge-close-characters.cpp) [Python](./Python/merge-close-characters.py) | _O(n + 26)_ | _O(26)_ | 中等 | | Simulation, Freq Table, Two Pointers, Sliding Window 3867 | [形成数对的 GCD 之和](https://leetcode.com/problems/sum-of-gcd-of-formed-pairs/) | [C++](./C++/sum-of-gcd-of-formed-pairs.cpp) [Python](./Python/sum-of-gcd-of-formed-pairs.py) | _O(nlogr)_ | _O(n)_ | 中等 | | Simulation, Prefix sum, Sort, Two Pointers 3894 | [交通信号灯颜色](https://leetcode.com/problems/traffic-signal-color/) | [C++](./C++/traffic-signal-color.cpp) [Python](./Python/traffic-signal-color.py) | _O(1)_ | _O(1)_ | 简单 | | Simulation

## 构造算法 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3139 | [使数组相等的最小成本](https://leetcode.com/problems/minimum-cost-to-equalize-array/) | [C++](./C++/minimum-cost-to-equalize-array.cpp) [Python](./Python/minimum-cost-to-equalize-array.py) | _O(n)_ | _O(1)_ | 困难 | | Constructive Algorithms, Math 3260 | [找出能被 K 整除的最大回文数](https://leetcode.com/problems/find-the-largest-palindrome-divisible-by-k/) | [C++](./C++/find-the-largest-palindrome-divisible-by-k.cpp) [Python](./Python/find-the-largest-palindrome-divisible-by-k.py) | _O(n)_ | _O(1)_ | 困难 | | String, Constructive Algorithms, Math | 3311 | [构造匹配图布局的 2D 网格](https://leetcode.com/problems/construct-2d-grid-matching-graph-layout/) | [C++](./C++/construct-2d-grid-matching-graph-layout.cpp) [Python](./Python/construct-2d-grid-matching-graph-layout.py) | _O(n)_ | _O(n)_ | 困难 | | Graph, Constructive Algorithms, BFS | 3375 | [使数组值等于 K 的最少操作次数](https://leetcode.com/problems/minimum-operations-to-make-array-values-equal-to-k/) | [C++](./C++/minimum-operations-to-make-array-values-equal-to-k.cpp) [Python](./Python/minimum-operations-to-make-array-values-equal-to-k.py) | _O(n)_ | _O(n)_ | 简单 | | Hash Table, Constructive Algorithms | 3680 | [生成日程表](https://leetcode.com/problems/generate-schedule/) | [C++](./C++/generate-schedule.cpp) [Python](./Python/generate-schedule.py) | _O(n^2)_ | _O(1)_ | 中等 | | Constructive Algorithms | 3875 | [构造均匀奇偶数组 I](https://leetcode.com/problems/construct-uniform-parity-array-i/) | [C++](./C++/construct-uniform-parity-array-i.cpp) [Python](./Python/construct-uniform-parity-array-i.py) | _O(1)_ | _O(1)_ | 简单 | | Constructive Algorithms | 3876 | [构造均匀奇偶数组 II](https://leetcode.com/problems/construct-uniform-parity-array-ii/) | [C++](./C++/construct-uniform-parity-array-ii.cpp) [Python](./Python/construct-uniform-parity-array-ii.py) | _O(n)_ | _O(1)_ | 中等 | | Constructive Algorithms |

## 设计 | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3242 | [设计相邻求和服务](https://leetcode.com/problems/design-neighbor-sum-service/) | [C++](./C++/design-neighbor-sum-service.cpp) [Python](./Python/design-neighbor-sum-service.py) | ctor: _O(n^2)_
adjacentSum: _O(1)_
diagonalSum: _O(1)_ | _O(n^2)_ | 简单 | | Hash Table 3369 | [设计数组统计跟踪器](https://leetcode.com/problems/design-an-array-statistics-tracker/) | [C++](./C++/design-an-array-statistics-tracker.cpp) [Python](./Python/design-an-array-statistics-tracker.py) | ctor: _O(1)_
addNumber: _O(logn)_
removeFirstAddedNumber: _O(logn)_
getMean: _O(1)_
getMedian: _O(1)_
getMode: _O(1)_ | _O(n)_ | 困难 | 🔒 | Deque, Freq Table, Sorted List, BST 3391 | [设计具有高效层跟踪的 3D 二进制矩阵](https://leetcode.com/problems/design-a-3d-binary-matrix-with-efficient-layer-tracking/) | [C++](./C++/design-a-3d-binary-matrix-with-efficient-layer-tracking.cpp) [Python](./Python/design-a-3d-binary-matrix-with-efficient-layer-tracking.py) | ctor: _O(1)_
setCell: _O(logn)_
unsetCell: _O(logn)_
largestMatrix: _O(logn)_ | _O(n^3)_ | 中等 | 🔒 | Heap, Sorted List 3408 | [设计任务管理器](https://leetcode.com/problems/design-task-manager/) | [C++](./C++/design-task-manager.cpp) [Python](./Python/design-task-manager.py) | ctor: _O(tlogt)_
add: _O(logt)_
edit: _O(logt)_
rmv: _O(logt)_
execTop: _O(logt)_ | _O(t)_ | 中等 | | Sorted List 3484 | [设计电子表格](https://leetcode.com/problems/design-spreadsheet/) | [C++](./C++/design-spreadsheet.cpp) [Python](./Python/design-spreadsheet.py) | ctor: _O(1)_
setCell: _O(1)_
resetCell: _O(1)_
getValue: _O(1)_ | _O(n)_ | 中等 | | Hash Table 3508 | [实现路由器](https://leetcode.com/problems/implement-router/) | [C++](./C++/implement-router.cpp) [Python](./Python/implement-router.py) | ctor: _O(1)_
addPacket: _O(logn)_
forwardPacket: _O(logn)_
getCount: _O(logn)_ | _O(n)_ | 中等 | | Queue, Sorted List, Ordered Set 3709 | [设计考试成绩跟踪器](https://leetcode.com/problems/design-exam-scores-tracker/) | [C++](./C++/design-exam-scores-tracker.cpp) [Python](./Python/design-exam-scores-tracker.py) | ctor: _O(1)_
record: _O(1)_
totalScore: _O(logn)_ | _O(n)_ | 中等 | | Prefix Sum, Binary Search 3815 | [设计拍卖系统](https://leetcode.com/problems/design-auction-system/) | [C++](./C++/design-auction-system.cpp) [Python](./Python/design-auction-system.py) | ctor: _O(1)_
addBid: _O(logn)_
updateBid: _O(logn)_
removeBid: _O(logn)_
getHighestBidder: _O(1)_ | _O(n)_ | 中等 | | Hash Table, Heap, Sorted List, BST 3822 | [设计订单管理系统](https://leetcode.com/problems/design-order-management-system/) | [C++](./C++/design-order-management-system.cpp) [Python](./Python/design-order-management-system.py) | ctor: _O(1)_
addOrder: _O(1)_
modifyOrder: _O(1)_
cancelOrder: _O(1)_
getOrdersAtPrice: _O(n)_ | _O(n)_ | 中等 | 🔒 | Hash Table 3829 | [设计拼车系统](https://leetcode.com/problems/design-ride-sharing-system/) | [C++](./C++/design-ride-sharing-system.cpp) [Python](./Python/design-ride-sharing-system.py) | ctor: _O(1)_
addRider: _O(1)_
addDriver: _O(1)_
matchDriverWithRider: _O(1)_
cancelRider: _O(1)_ | _O(n)_ | 中等 | | Ordered Dict 3885 | [设计事件管理器](https://leetcode.com/problems/design-event-manager/) | [C++](./C++/design-event-manager.cpp) [Python](./Python/design-event-manager.py) | ctor: _O(n)_
updatePriority: _O(logn)_
pollHightest: _O(logn)_ | _O(n)_ | 中等 | | Sorted List, BST, Heap, Hash Table

## JS | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----|

## SQL | # | 标题 | 题解 | 时间 | 空间 | 难度 | 标签 | 备注| |-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|-----| 3050 | [披萨配料成本分析](https://leetcode.com/problems/pizza-toppings-cost-analysis/) | [MySQL](./MySQL/pizza-toppings-cost-analysis.sql) | _O(n^3 * logn)_ | _O(n^3)_ | 中等 |🔒|| 3051 | [找出数据科学家职位的候选人](https://leetcode.com/problems/find-candidates-for-data-scientist-position/) | [MySQL](./MySQL/find-candidates-for-data-scientist-position.sql) | _O(nlogn)_ | _O(n)_ | 简单 |🔒|| 3052 | [最大化物品数量](https://leetcode.com/problems/maximize-items/) | [MySQL](./MySQL/maximize-items.sql) | _O(n)_ | _O(n)_ | 困难 |🔒|| 3053 | [按长度对三角形进行分类](https://leetcode.com/problems/classifying-triangles-by-lengths/) | [MySQL](./MySQL/classifying-triangles-by-lengths.sql) | _O(n)_ | _O(n)_ | 简单 |🔒|| 3054 | [二叉树节点](https://leetcode.com/problems/binary-tree-nodes/) | [MySQL](./MySQL/binary-tree-nodes.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒|| 3055 | [Top 百分位欺诈](https://leetcode.com/problems/top-percentile-fraud/) | [MySQL](./MySQL/top-percentile-fraud.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒|| 3056 | [快照分析](https://leetcode.com/snaps-analysis/) | [MySQL](./MySQL/snaps-analysis.sql) | _O(n)_ | _O(n)_ | 中等 |🔒|| 3057 | [员工项目分配](https://leetcode.com/problems/employees-project-allocation/) | [MySQL](./MySQL/employees-project-allocation.sql) | _O(nlogn)_ | _O(n)_ | 困难 |🔒|| 3058 | [没有共同朋友的朋友](https://leetcode.com/problems/friends-with-no-mutual-friends/) | [MySQL](./MySQL/friends-with-no-mutual-friends.sql) | _O(n^2 * logn)_ | _O(n^2)_ | 中等 |🔒|| 3059 | [找出所有唯一的电子邮件域](https://leetcode.com/problems/find-all-unique-email-domains/) | [MySQL](./MySQL/find-all-unique-email-domains.sql) | _O(nlogn)_ | _O(n)_ | 简单 |🔒|| 3060 | [时间范围内的用户活动](https://leetcode.com/problems/user-activities-within-time-bounds/) | [MySQL](./MySQL/user-activities-within-time-bounds.sql) | _O(nlogn)_ | _O(n)_ | 困难 |🔒|| 3061 | [计算接雨水](https://leetcode.com/problems/calculate-trapping-rain-water/) | [MySQL](./MySQL/calculate-trapping-rain-water.sql) | _O(nlogn)_ | _O(n)_ | 困难 |🔒|| 3087 | [找出热门标签](https://leetcode.com/problems/find-trending-hashtags/) | [MySQL](./MySQL/find-trending-hashtags.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒|| 3089 | [发现突发行为](https://leetcode.com/problems/find-bursty-behavior/) | [MySQL](./MySQL/find-bursty-behavior.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒| Window Function | 3103 | [找出热门标签 II](https://leetcode.com/problems/find-trending-hashtags-ii/) | [MySQL](./MySQL/find-trending-hashtags-ii.sql) | _O(n * l^2 + (n * l) * log(n * l))_ | _O(n * l^2)_ | 困难 |🔒| Recursive CTE | 3118 | [周五购买 III](https://leetcode.com/problems/friday-purchase-iii/) | [MySQL](./MySQL/friday-purchase-iii.sql) | _O(n)_ | _O(n)_ | 中等 |🔒|| 3124 | [查找最长通话](https://leetcode.com/problems/find-longest-calls/) | [MySQL](./MySQL/find-longest-calls.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒| Window Function | 3126 | [服务器使用时间](https://leetcode.com/problems/server-utilization-time/) | [MySQL](./MySQL/server-utilization-time.sql) | _O(nlogn)_ | _O(n)_ | 中等 || Window Function | 3140 | [连续空闲座位 II](https://leetcode.com/problems/consecutive-available-seats-ii/) | [MySQL](./MySQL/consecutive-available-seats-ii.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒| Window Function | 3150 | [无效推文 II](https://leetcode.com/problems/invalid-tweets-ii/) | [MySQL](./Python/sort-matrix-by-diagonals.py) | _O(n * l + nlogn)_ | _O(n * l)_ | 简单 |🔒| String | 3156 | [员工任务持续时间和并发任务](https://leetcode.com/problems/employee-task-duration-and-concurrent-tasks/) | [MySQL](./MySQL/employee-task-duration-and-concurrent-tasks.sql) | _O(nlogn)_ | _O(n)_ | 困难 |🔒| Line Sweep | 3166 | [计算停车费用和时长](https://leetcode.com/problems/calculate-parking-fees-and-duration/) | [MySQL](./MySQL/calculate-parking-fees-and-duration.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒| | 3172 | [次日验证](https://leetcode.com/problems/second-day-verification/) | [MySQL](./MySQL/second-day-verification.sql) | _O(nlogn)_ | _O(n)_ | 简单 |🔒| | 3182 | [查找得分最高的学生](https://leetcode.com/problems/find-top-scoring-students/) | [MySQL](./MySQL/find-top-scoring-students.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒| | 3188 | [查找得分最高的学生 II](https://leetcode.com/problems/find-top-scoring-students-ii/) | [MySQL](./MySQL/find-top-scoring-students-ii.sql) | _O(nlogn)_ | _O(n)_ | 困难 |🔒| | 3198 | [查找每个州的城市](https://leetcode.com/problems/find-cities-in-each-state/) | [MySQL](./MySQL/find-cities-in-each-state.sql) | _O(nlogn)_ | _O(n)_ | 简单 |🔒| | 3204 | [按位用户权限分析](https://leetcode.com/problems/bitwise-user-permissions-analysis/) | [MySQL](./MySQL/bitwise-user-permissions-analysis.sql) | _O(n)_ | _O(n)_ | 中等 |🔒| | 3214 | [同比增长率](https://leetcode.com/problems/year-on-year-growth-rate/) | [MySQL](./MySQL/year-on-year-growth-rate.sql) | _O(nlogn)_ | _O(n)_ | 困难 |🔒| Window Function | 3220 | [奇数和偶数交易](https://leetcode.com/problems/odd-and-even-transactions/) | [MySQL](./MySQL/odd-and-even-transactions.sql) | _O(nlogn)_ | _O(n)_ | 中等 || | 3230 | [客户购买行为分析](https://leetcode.com/problems/customer-purchasing-behavior-analysis/) | [MySQL](./MySQL/customer-purchasing-behavior-analysis.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒| Window Function | 3236 | [CEO 下属层级](https://leetcode.com/problems/ceo-subordinate-hierarchy/) | [MySQL](./MySQL/ceo-subordinate-hierarchy.sql) | _O(nlogn)_ | _O(n)_ | 困难 |🔒| Recursive CTE, BFS | 3246 | [英超联赛排名](https://leetcode.com/problems/premier-league-table-ranking/) | [MySQL](./MySQL/premier-league-table-ranking.sql) | _O(nlogn)_ | _O(n)_ | 简单 |🔒| Window Function | 3252 | [英超联赛排名 II](https://leetcode.com/problems/premier-league-table-ranking-ii/) | [MySQL](./MySQL/premier-league-table-ranking-ii.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒| Window Function | 3262 | [查找重叠班次](https://leetcode.com/problems/find-overlapping-shifts/) | [MySQL](./MySQL/find-overlapping-shifts.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒| Line Sweep | 3268 | [查找重叠班次 II](https://leetcode.com/problems/find-overlapping-shifts-ii/) | [MySQL](./MySQL/find-overlapping-shifts-ii.sql) | _O(n^2)_ | _O(n^2)_ | 困难 |🔒| Line Sweep, Window Function, Combinatorics | 3278 | [查找数据科学家职位候选人 II](https://leetcode.com/problems/find-candidates-for-data-scientist-position-ii/) | [MySQL](./MySQL/find-candidates-for-data-scientist-position-ii.sql) | _O(p * s * n + p * nlogn + plogp)_ | _O(p * s * n)_ | 中等 |🔒| Window Function | 3293 | [计算产品最终价格](https://leetcode.com/problems/calculate-product-final-price/) | [MySQL](./MySQL/calculate-product-final-price.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒| | 3308 | [查找表现最佳的司机](https://leetcode.com/problems/find-top-performing-driver/) | [MySQL](./MySQL/find-top-performing-driver.sql) | _O(tlogt)_ | _O(t)_ | 中等 |🔒| Window Function | 3322 | [英超联赛排名 III](https://leetcode.com/problems/premier-league-table-ranking-iii/) | [MySQL](./MySQL/premier-league-table-ranking-iii.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒| Window Function | 3328 | [查找每个州的城市 II](https://leetcode.com/problems/find-cities-in-each-state-ii/) | [MySQL](./MySQL/find-cities-in-each-state-ii.sql) | _O(nlogn)_ | _O(n)_ | 中等 |🔒| | 3338 | [第二高的薪水 II](https://leetcode.com/problems/second-highest-salary-ii/) | [MySQL](./MySQL/second-highest-salary-ii.sql) | _O(nlogn)_ |
标签:C++, DNS解析, Google Code Jam, Google Kick Start, LeetCode, LintCode, Meta Hacker Cup, Modern C++, Python, 代码库, 位运算, 刷题, 多线程, 字符串, 学习资源, 开源项目, 数据可视化, 数据擦除, 数据结构, 数组, 无后门, 每周更新, 算法, 算法竞赛, 编程竞赛, 编程题, 计算机科学, 逆向工具, 链表, 面试准备, 题解