算法刷题

算法刷题记录与掌握度追踪

20 总题数
0 本周新增
3 Easy
13 Medium
4 Hard
5 熟悉
0 需复习

掌握度分布

熟悉
5
了解
15

分类标签

array 16
hashmap 6
two-pointers 6
matrix 4
sorting 3
string 2
prefix-sum 2
subarray 2
sliding-window 2
math 2

刷题记录

2026-07-06 Monday

17. Set Matrix Zeroes LeetCode Medium 了解

用首行首列做标记位,O(1) 额外空间

array matrix in-place
18. Spiral Matrix LeetCode Medium 熟悉

按上下左右四条边走,走过的移除,每轮访问四条边界

array matrix simulation
19. Rotate Image LeetCode Medium 了解

原地旋转,先水平翻转再沿主对角线翻转,等价于 90° 顺时针

array matrix math
20. Search a 2D Matrix II LeetCode Medium 了解

从右上角开始,比 target 大左移,比 target 大下移,O(m+n)

array matrix binary-search

2026-07-05 Sunday

12. Maximum Subarray LeetCode Medium 了解

动态规划,pre = max(pre + x, x),pre 表示以当前数结尾的最大和

array dp subarray
13. Merge Intervals LeetCode Medium 了解

排序 + 贪心,按左端点排序后遍历,重叠就更新右端点

array sorting greedy intervals
14. Rotate Array LeetCode Medium 熟悉

三次反转:整体反转 + 前 k 反转 + 后 n-k 反转,注意 k %= n

array two-pointers math
15. Product of Array Except Self LeetCode Medium 了解

左右乘积数组 L[i]*R[i],空间可优化到 O(1)

array prefix-product
16. First Missing Positive LeetCode Hard 了解

原地哈希:把 <=0 的数改成 n+1,再对 [1,n] 用负号打标记,第一个正数位置 i+1 即答案

array hashmap in-place

2026-06-18 Thursday

前缀和数组 s[i+1]=s[i]+nums[i],查询 O(1):s[right+1]-s[left]

prefix-sum array design
9. Subarray Sum Equals K LeetCode Medium 了解

前缀和 + 哈希表,统计 s[j]-k 出现次数

prefix-sum hashmap subarray
10. Minimum Window Substring LeetCode Hard 了解

滑动窗口,r 扩张找可行解,l 收缩优化,注意 size() 无符号数陷阱

sliding-window hashmap string two-pointers
11. Sliding Window Maximum LeetCode Hard 了解

单调队列(双端队列),队头存当前窗口最大值

monotonic-queue sliding-window deque

2026-06-17 Wednesday

6. 3Sum LeetCode Medium 了解

排序+双指针,注意去重

array two-pointers sorting
7. Trapping Rain Water LeetCode Hard 熟悉

双指针左右夹逼,lmax 和 rmax 取较小的一边累计

array two-pointers stack

2026-06-16 Tuesday

4. Container With Most Water LeetCode Medium 了解

双指针从两端向中间收敛,每次移动短板

array two-pointers
5. Move Zeroes LeetCode Easy 了解

快慢指针,慢指针左侧都是非零数

array two-pointers

2026-06-15 Monday

1. Two Sum LeetCode Easy 熟悉

哈希表一次遍历 O(n),注意 unordered_map 用法

array hashmap
2. Group Anagrams LeetCode Medium 熟悉

对每个字符串排序作为 key,哈希表分组

hashmap string sorting
3. Longest Consecutive Sequence LeetCode Medium 了解

哈希表存端点,只从连续序列起点开始计数 O(n)

hashmap array