<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>LeetCode on Jeanphilo Blog</title><link>https://shio-chan-dev.github.io/jeanblog/zh/categories/leetcode/</link><description>Recent content in LeetCode on Jeanphilo Blog</description><generator>Hugo -- 0.159.2</generator><language>zh-cn</language><lastBuildDate>Thu, 02 Apr 2026 13:48:57 +0800</lastBuildDate><atom:link href="https://shio-chan-dev.github.io/jeanblog/zh/categories/leetcode/index.xml" rel="self" type="application/rss+xml"/><item><title>Hot100：电话号码的字母组合（Letter Combinations of a Phone Number）固定层数 DFS ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/backtracking/17-letter-combinations-of-a-phone-number/</link><pubDate>Thu, 02 Apr 2026 13:48:57 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/backtracking/17-letter-combinations-of-a-phone-number/</guid><description>围绕 LeetCode 17 讲清固定层数 DFS、数字到字母映射与多语言实现。</description></item><item><title>Hot100：全排列（Permutations）used[] 状态回溯模板 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/backtracking/46-permutations/</link><pubDate>Thu, 02 Apr 2026 13:48:57 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/backtracking/46-permutations/</guid><description>围绕 LeetCode 46 全排列，讲清 used[] 状态控制、叶子收集答案与多语言实现。</description></item><item><title>Hot100：子集（Subsets）回溯枚举 / startIndex 模板 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/backtracking/78-subsets/</link><pubDate>Thu, 02 Apr 2026 13:48:57 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/backtracking/78-subsets/</guid><description>围绕 LeetCode 78 子集，讲清回溯树、startIndex 边界与多语言可运行实现。</description></item><item><title>Hot100：组合总和（Combination Sum）回溯剪枝 / 可重复选取 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/backtracking/39-combination-sum/</link><pubDate>Thu, 02 Apr 2026 13:48:57 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/backtracking/39-combination-sum/</guid><description>围绕 LeetCode 39 讲清可重复选取、排序剪枝与组合型回溯实现。</description></item><item><title>克隆图：哈希表 + DFS/BFS 实现无向图深拷贝（LeetCode 133）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/133-clone-graph/</link><pubDate>Thu, 19 Mar 2026 13:18:26 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/133-clone-graph/</guid><description>用原节点到新节点的映射表实现无向连通图深拷贝，覆盖 DFS 与 BFS 两种写法、环处理、正确性分析与多语言可运行实现。</description></item><item><title>Hot100：二叉树的层序遍历（Binary Tree Level Order Traversal）BFS / DFS ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/102-binary-tree-level-order-traversal/</link><pubDate>Sun, 15 Mar 2026 21:29:44 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/102-binary-tree-level-order-traversal/</guid><description>讲透 LeetCode 102 的按层 BFS、层宽控制与 DFS depth bucket 备选方案，附工程迁移和多语言实现。</description></item><item><title>Hot100：对称二叉树（Symmetric Tree）镜像递归 / BFS ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/101-symmetric-tree/</link><pubDate>Sun, 15 Mar 2026 21:29:43 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/101-symmetric-tree/</guid><description>围绕 LeetCode 101 讲清镜像递归、BFS 成对入队与树形结构对称校验，附工程迁移和多语言实现。</description></item><item><title>相同的树（Same Tree）同步递归 / BFS ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/100-same-tree/</link><pubDate>Sun, 15 Mar 2026 21:29:42 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/100-same-tree/</guid><description>围绕 LeetCode 100 讲清同步递归比较、队列成对校验与结构等价判断，附工程迁移与多语言实现。</description></item><item><title>Hot100：翻转二叉树（Invert Binary Tree）递归 / BFS ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/226-invert-binary-tree/</link><pubDate>Fri, 06 Mar 2026 17:58:23 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/226-invert-binary-tree/</guid><description>围绕 LeetCode 226 讲清树镜像变换、递归交换左右子树的本质，以及工程里的结构镜像场景。</description></item><item><title>Hot100：二叉树的最大深度（Maximum Depth of Binary Tree）DFS / BFS ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/104-maximum-depth-of-binary-tree/</link><pubDate>Fri, 06 Mar 2026 17:58:22 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/104-maximum-depth-of-binary-tree/</guid><description>讲透 LeetCode 104 的深度定义、递归 DFS 与层序 BFS 两种主流解法，附工程迁移和多语言实现。</description></item><item><title>Hot100：二叉树的中序遍历（Binary Tree Inorder Traversal）递归 / 显式栈 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/94-binary-tree-inorder-traversal/</link><pubDate>Fri, 06 Mar 2026 17:58:21 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/94-binary-tree-inorder-traversal/</guid><description>用左-根-右模板讲透 LeetCode 94，覆盖递归、显式栈与工程迁移场景，附多语言可运行实现。</description></item><item><title>LeetCode 146：LRU 缓存设计（O(1)）哈希表 + 双向链表实战</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/146-lru-cache/</link><pubDate>Wed, 11 Feb 2026 08:02:05 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/146-lru-cache/</guid><description>LRUCache 的核心是用哈希表做 O(1) 定位、双向链表维护最近使用顺序，实现 get/put 平均 O(1)。本文按 ACERS 模板给出推导、工程应用与多语言代码。</description></item><item><title>LeetCode 138：随机链表的复制（Copy List with Random Pointer）深拷贝全解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/138-copy-list-with-random-pointer/</link><pubDate>Wed, 11 Feb 2026 07:59:32 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/138-copy-list-with-random-pointer/</guid><description>随机链表复制的核心是把“原节点身份”映射到“新节点身份”，再重建 next/random 指针。本文用 ACERS 结构给出思路推导、工程类比、常见坑和多语言可运行实现。</description></item><item><title>LeetCode 19：删除链表的倒数第 N 个结点（双指针一趟扫描）ACERS 全解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/19-remove-nth-node-from-end-of-list/</link><pubDate>Wed, 11 Feb 2026 07:56:02 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/19-remove-nth-node-from-end-of-list/</guid><description>从朴素两趟遍历到一趟快慢指针，系统讲清删除链表倒数第 N 个结点的思路、正确性、工程场景与多语言可运行实现。</description></item><item><title>LeetCode 2：两数相加（Add Two Numbers）链表进位从朴素到最优解</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/2-add-two-numbers/</link><pubDate>Wed, 11 Feb 2026 07:54:26 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/2-add-two-numbers/</guid><description>把两个逆序链表表示的非负整数相加，关键是逐位相加与进位传播。本文用 ACERS 结构讲透思路推导、工程类比与多语言可运行实现。</description></item><item><title>Hot100：排序链表（Sort List）链表归并排序 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/148-sort-list/</link><pubDate>Tue, 10 Feb 2026 17:07:38 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/148-sort-list/</guid><description>在 O(n log n) 时间内对单链表排序。本文用“快慢指针找中点 + 分治归并”给出稳定模板，并对比数组化方案、常见坑和多语言实现。</description></item><item><title>Hot100：合并K个升序链表（Merge k Sorted Lists）分治归并 O(N log k) ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/23-merge-k-sorted-lists/</link><pubDate>Tue, 10 Feb 2026 17:05:53 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/23-merge-k-sorted-lists/</guid><description>把 LeetCode 21 的双链表归并扩展到 k 路：从朴素串行合并到分治归并，时间复杂度降到 O(N log k)，并对比最小堆方案与工程取舍，附多语言实现。</description></item><item><title>Hot100：K 个一组翻转链表（Reverse Nodes in k-Group）分组反转 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/25-reverse-nodes-in-k-group/</link><pubDate>Tue, 10 Feb 2026 10:01:23 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/25-reverse-nodes-in-k-group/</guid><description>在单链表中每 k 个节点为一组进行原地反转，不足 k 的尾组保持不变。本文给出哑节点 + 分组扫描 + 原地反转模板，时间 O(n)、额外空间 O(1)，附多语言实现。</description></item><item><title>反转链表 II（Reverse Linked List II）哑节点+头插法 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/92-reverse-linked-list-ii/</link><pubDate>Tue, 10 Feb 2026 09:56:14 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/92-reverse-linked-list-ii/</guid><description>在单链表中仅反转区间 [left, right]：用哑节点定位前驱，再用头插法原地重排，时间 O(n)、额外空间 O(1)，附工程思路与多语言实现。</description></item><item><title>Hot100：路径和 III 前缀和 + 哈希表统计向下路径（LeetCode 437）ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/437-path-sum-iii/</link><pubDate>Mon, 02 Feb 2026 22:13:45 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/binary-tree/437-path-sum-iii/</guid><description>用前缀和 + 计数哈希表在 O(n) 时间统计二叉树中和为 targetSum 的向下路径数，含推导、工程迁移与多语言实现。</description></item><item><title>Hot100：环形链表 II（Linked List Cycle II）Floyd 判环 + 定位入环点 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/142-linked-list-cycle-ii/</link><pubDate>Sun, 01 Feb 2026 21:40:21 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/142-linked-list-cycle-ii/</guid><description>不修改链表的前提下返回入环的第一个节点：Floyd 快慢指针先相遇判环，再从头与相遇点同步前进定位入环点；O(n) 时间、O(1) 额外空间。</description></item><item><title>Hot100：合并两个有序链表（Merge Two Sorted Lists）哨兵节点归并 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/21-merge-two-sorted-lists/</link><pubDate>Sun, 01 Feb 2026 21:40:06 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/21-merge-two-sorted-lists/</guid><description>用哨兵节点 + 双指针在 O(m+n) 时间把两个升序链表“拼接式”合并为一个升序链表，并对比递归写法与常见坑，附多语言可运行实现（Hot100）。</description></item><item><title>Hot100：环形链表（Linked List Cycle）Floyd 快慢指针 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/141-linked-list-cycle/</link><pubDate>Sun, 01 Feb 2026 18:45:44 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/141-linked-list-cycle/</guid><description>用 Floyd 快慢指针在 O(n) 时间、O(1) 额外空间判断单链表是否有环，并对比哈希表方案、常见坑与工程迁移，附多语言可运行实现（Hot100）。</description></item><item><title>Hot100：回文链表（Palindrome Linked List）快慢指针 + 反转后半段 O(1) 空间 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/234-palindrome-linked-list/</link><pubDate>Sun, 01 Feb 2026 18:44:01 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/234-palindrome-linked-list/</guid><description>判断单链表是否为回文：快慢指针定位中点、原地反转后半段并与前半段对比，最后再恢复链表；O(n) 时间、O(1) 额外空间。</description></item><item><title>Hot100：反转链表（Reverse Linked List）三指针迭代/递归 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/206-reverse-linked-list/</link><pubDate>Sun, 01 Feb 2026 16:30:26 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/206-reverse-linked-list/</guid><description>用三指针迭代在 O(n) 时间、O(1) 额外空间反转单链表，并对比递归写法与常见坑，附多语言可运行实现（Hot100）。</description></item><item><title>Hot100：相交链表（Intersection of Two Linked Lists）双指针换头 O(1) 空间 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/160-intersection-of-two-linked-lists/</link><pubDate>Sun, 01 Feb 2026 16:29:40 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/linked-list/160-intersection-of-two-linked-lists/</guid><description>在不破坏链表结构的前提下找到两个单链表的相交起点：双指针“走完 A 再走 B”保证同步，O(m+n) 时间、O(1) 额外空间；含推导、工程迁移与多语言实现。</description></item><item><title>Hot100：搜索二维矩阵 II（Search a 2D Matrix II）右上角阶梯搜索 O(m+n) ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/240-search-a-2d-matrix-ii/</link><pubDate>Sun, 01 Feb 2026 13:56:55 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/240-search-a-2d-matrix-ii/</guid><description>行列均升序的矩阵查找 target：从右上角出发每步排除一行或一列，O(m+n) 时间、O(1) 空间；含推导、工程迁移与多语言实现。</description></item><item><title>Hot100：螺旋矩阵（Spiral Matrix）边界收缩模拟 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/54-spiral-matrix/</link><pubDate>Sun, 01 Feb 2026 13:55:22 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/54-spiral-matrix/</guid><description>用“边界收缩”在 O(mn) 时间输出矩阵的顺时针螺旋序列，附工程场景、易错点与多语言实现（Hot100）。</description></item><item><title>Hot100：旋转图像（Rotate Image）转置 + 行反转实现原地 90 度旋转 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/48-rotate-image/</link><pubDate>Sun, 01 Feb 2026 13:51:51 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/48-rotate-image/</guid><description>顺时针旋转 n×n 矩阵 90 度：用“先转置、再反转每一行”在 O(n^2) 时间、O(1) 额外空间原地完成；含推导、工程场景与多语言实现。</description></item><item><title>矩阵置零：用首行首列做标记实现原地 O(1) 空间（LeetCode 73）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/73-set-matrix-zeroes/</link><pubDate>Sun, 01 Feb 2026 12:53:35 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/73-set-matrix-zeroes/</guid><description>把首行首列当作标记位，在不额外开集合的前提下原地完成矩阵置零；含思路推导、常见坑与多语言实现。</description></item><item><title>Hot100：缺失的第一个正数（First Missing Positive）原地索引定位 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/41-first-missing-positive/</link><pubDate>Sat, 24 Jan 2026 12:42:31 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/41-first-missing-positive/</guid><description>用原地索引定位在 O(n) 时间、O(1) 额外空间找到缺失的第一个正数，含工程场景与多语言实现。</description></item><item><title>Hot100：除自身以外数组的乘积（Product of Array Except Self）前后缀乘积 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/238-product-of-array-except-self/</link><pubDate>Sat, 24 Jan 2026 12:35:09 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/238-product-of-array-except-self/</guid><description>O(n) 时间、无需除法，用前后缀乘积求解除自身以外数组的乘积，含工程场景与多语言实现。</description></item><item><title>Hot100：轮转数组（Rotate Array）三次反转 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/189-rotate-array/</link><pubDate>Sat, 24 Jan 2026 12:29:42 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/189-rotate-array/</guid><description>用三次反转在 O(n) 时间完成轮转数组，含工程场景、常见误区与多语言实现。</description></item><item><title>Hot100：合并区间（Merge Intervals）排序扫描 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/56-merge-intervals/</link><pubDate>Sat, 24 Jan 2026 11:21:03 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/56-merge-intervals/</guid><description>围绕合并区间（LeetCode 56）讲清排序+线性扫描的核心思路、工程场景与多语言实现。</description></item><item><title>Hot100：接雨水（Trapping Rain Water）双指针 / 前后最大值 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/42-trapping-rain-water/</link><pubDate>Sat, 24 Jan 2026 10:27:35 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/42-trapping-rain-water/</guid><description>用双指针与左右最大值在 O(n) 时间计算接雨水总量，含工程场景、常见误区与多语言实现。</description></item><item><title>Hot100：最大子数组和（Maximum Subarray）Kadane 一维 DP ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/53-maximum-subarray/</link><pubDate>Fri, 23 Jan 2026 11:58:26 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/53-maximum-subarray/</guid><description>用 Kadane 算法在 O(n) 时间求最大子数组和，含工程场景、常见误区与多语言实现。</description></item><item><title>固定间距 1 检测：一次扫描判断 1 之间至少 k 个间隔（LeetCode 1437）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/1437-check-if-all-ones-are-at-least-k-places-away/</link><pubDate>Thu, 22 Jan 2026 09:12:14 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/1437-check-if-all-ones-are-at-least-k-places-away/</guid><description>用一次扫描判断所有 1 之间是否至少相隔 k 个位置，含工程场景、常见误区与多语言实现。</description></item><item><title>判断一个数是否为 2 的幂（Power of Two）：位运算 O(1) ACERS 解析（LeetCode 231）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/231-power-of-two/</link><pubDate>Wed, 21 Jan 2026 13:22:53 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/231-power-of-two/</guid><description>用位运算 O(1) 判断整数是否为 2 的幂，含工程场景、常见误区与多语言实现。</description></item><item><title>LeetCode 76：最小覆盖子串（Minimum Window Substring）滑动窗口 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/76-minimum-window-substring/</link><pubDate>Tue, 20 Jan 2026 21:59:19 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/76-minimum-window-substring/</guid><description>用可变滑动窗口与计数哈希表在 O(n) 时间找到最小覆盖子串，含工程场景与多语言实现。</description></item><item><title>LeetCode 1456：最大元音子串数量的滑动窗口 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/1456-maximum-number-of-vowels-in-a-substring-of-given-length/</link><pubDate>Tue, 20 Jan 2026 13:40:45 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/1456-maximum-number-of-vowels-in-a-substring-of-given-length/</guid><description>用固定滑动窗口在 O(n) 时间求最大元音子串数量，含工程迁移与多语言实现。</description></item><item><title>LeetCode 1513：仅含 1 的子串数量（连续 1 子串计数）ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/1513-number-of-substrings-with-only-ones/</link><pubDate>Sun, 18 Jan 2026 18:42:59 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/1513-number-of-substrings-with-only-ones/</guid><description>用连续段在线统计在 O(n) 时间计算仅含 1 的子串数量，含工程场景与多语言实现。</description></item><item><title>滑动窗口最大值：单调队列（Monotonic Queue）一遍扫描 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/239-sliding-window-maximum/</link><pubDate>Sun, 18 Jan 2026 18:32:08 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/239-sliding-window-maximum/</guid><description>用单调队列在 O(n) 时间求滑动窗口最大值，含工程场景、复杂度对比与多语言实现。</description></item><item><title>Hot100：和为 K 的子数组（Subarray Sum Equals K）前缀和 + 哈希表 ACERS 解析</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/560-subarray-sum-equals-k/</link><pubDate>Sat, 17 Jan 2026 20:49:25 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/560-subarray-sum-equals-k/</guid><description>用前缀和与哈希表在 O(n) 时间统计和为 K 的子数组数量，含工程场景、多语言实现与常见误区。</description></item><item><title>数据结构基础：好数对计数（Number of Good Pairs）哈希统计 ACERS 解析（LeetCode 1512）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/1512-number-of-good-pairs/</link><pubDate>Tue, 30 Dec 2025 11:40:00 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/1512-number-of-good-pairs/</guid><description>用哈希计数一遍扫描解决好数对（Good Pairs）问题，附工程场景、复杂度对比与多语言实现。</description></item><item><title>Hot100：Two Sum 两数之和哈希表一遍扫描与 ACERS 工程化解析（LeetCode 1）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/1-two-sum/</link><pubDate>Sun, 28 Dec 2025 10:00:00 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/1-two-sum/</guid><description>从题意还原到哈希表一遍扫描，系统讲解 Two Sum，并给出工程场景、复杂度对比与多语言实现。</description></item><item><title>最大正负数计数：用二分在排序数组中统计正整数和负整数数量的最大值（LeetCode 2529）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/binary-search/2529-maximum-count-of-positive-integer-and-negative-integer/</link><pubDate>Thu, 04 Dec 2025 11:40:00 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/binary-search/2529-maximum-count-of-positive-integer-and-negative-integer/</guid><description>在排序数组中统计正整数和负整数数量的最大值（Maximum Count of Positive &amp;amp; Negative Integers）。本文用上下界二分模板一次性找到负数结束位置和正数起始位置，并给出多语言实现与工程应用示例。</description></item><item><title>比目标字母大的最小字母：有序字符数组上的二分查找技巧（LeetCode 744）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/binary-search/744-find-smallest-letter-greater-than-target/</link><pubDate>Thu, 04 Dec 2025 11:30:00 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/binary-search/744-find-smallest-letter-greater-than-target/</guid><description>在排序字符数组中查找比目标字母大的最小字母（Find Smallest Letter Greater Than Target），支持环绕。本文用 upper_bound 二分模板稳定处理边界，并提供多语言实现和工程实践示例。</description></item><item><title>经典 Binary Search：在排序数组中查找目标值索引的统一模板（LeetCode 704）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/binary-search/704-binary-search/</link><pubDate>Thu, 04 Dec 2025 11:20:00 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/binary-search/704-binary-search/</guid><description>在有序数组中查找目标值：存在返回下标，不存在返回 -1。本文以 LeetCode 704 为例，用统一的二分模板讲清楚边界处理，并给出多语言实现和工程实践示例。</description></item><item><title>Hot100：Search Insert Position 排序数组中目标值插入位置的二分查找实战（LeetCode 35）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/35-search-insert-position/</link><pubDate>Thu, 04 Dec 2025 11:10:00 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/35-search-insert-position/</guid><description>在有序数组中寻找目标值插入位置，使数组仍然有序：存在返回下标，不存在返回应插入的位置。本文用统一的 lower_bound 二分模板实现 Search Insert Position，并给出多语言代码与工程应用示例。</description></item><item><title>Hot100：在排序数组中查找元素的起始和结束位置，一套二分模板搞定 Search Range（LeetCode 34）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/34-find-first-and-last-position-of-element-in-sorted-array/</link><pubDate>Thu, 04 Dec 2025 11:00:00 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/hot100/34-find-first-and-last-position-of-element-in-sorted-array/</guid><description>在有序数组中找到目标值的起始和结束位置（Search Range），要求 O(log n) 时间。本文用下界/上界二分模板彻底解决边界问题，并给出多语言代码和工程实践示例。</description></item><item><title>咒语与药水的成功组合：排序 + 二分查找秒杀乘积约束问题（LeetCode 2300）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/2300-successful-pairs-of-spells-and-potions/</link><pubDate>Thu, 04 Dec 2025 10:50:00 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/2300-successful-pairs-of-spells-and-potions/</guid><description>给定 spells 和 potions 两个数组以及 success 阈值，如何用排序 + 二分查找在 O((n+m)log m) 时间内求出每个咒语能与多少药水形成乘积 ≥ success 的成功组合，并给出多语言实现与工程应用示例。</description></item><item><title>固定长度子数组 + 至少 m 个不同元素：几乎唯一子数组的最大和（LeetCode 2841）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/2841-maximum-sum-of-almost-unique-subarray/</link><pubDate>Thu, 04 Dec 2025 10:40:00 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/2841-maximum-sum-of-almost-unique-subarray/</guid><description>给定整数数组 nums 和正整数 m、k，要求在所有长度为 k、且至少包含 m 个不同元素的子数组中，找到最大和；若不存在返回 0。本文用滑动窗口 + 计数哈希表推导 O(n) 解法，并提供多语言实现与工程应用示例。</description></item><item><title>最少涂色次数拿到 k 个连续黑块：滑动窗口的极简解法（LeetCode 2379）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/2379-minimum-recolors-to-get-k-consecutive-black-blocks/</link><pubDate>Thu, 04 Dec 2025 10:30:00 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/2379-minimum-recolors-to-get-k-consecutive-black-blocks/</guid><description>给定只包含 W/B 的字符串 blocks，每次可将一个 W 涂成 B，如何用一次线性扫描求出得到至少一次连续 k 个黑色块的最少操作次数，并给出多语言实现与工程应用示例。</description></item><item><title>一位与两位编码解析的刷题笔记与工程应用全解析（续集，LeetCode 717）</title><link>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/717-1-bit-and-2-bit-characters/</link><pubDate>Tue, 18 Nov 2025 23:43:17 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/zh/alg/leetcode/717-1-bit-and-2-bit-characters/</guid><description>&lt;h1 id="一位与两位编码解析的刷题笔记与工程应用全解析续集leetcode-717"&gt;&lt;strong&gt;一位与两位编码解析的刷题笔记与工程应用全解析（续集，LeetCode 717）&lt;/strong&gt;&lt;/h1&gt;
&lt;h2 id="副标题--摘要"&gt;&lt;strong&gt;副标题 / 摘要&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;本文解析 LeetCode《1-bit and 2-bit Characters》题目，讲解如何用简单的指针跳跃算法解析二进制编码序列，并展示该算法在通信协议、数据格式解析、事件流处理等工程场景中的真实应用。适合希望将算法题知识迁移到工程系统的开发者。&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="目标读者"&gt;&lt;strong&gt;目标读者&lt;/strong&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;刷 LeetCode、准备技术面试的开发者&lt;/li&gt;
&lt;li&gt;对通信协议、序列解析、数据流处理感兴趣的工程师&lt;/li&gt;
&lt;li&gt;想提升“抽象能力与工程迁移能力”的同学&lt;/li&gt;
&lt;li&gt;从事监控、序列分析、协议解析等工作的后端开发者&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="背景--动机为什么这题值得写一篇博客"&gt;&lt;strong&gt;背景 / 动机：为什么这题值得写一篇博客？&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;乍一看，这道题好像只是简单判断：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;一个由 0/1 组成的编码流，最后一个 0 是否单独构成一个 1 位字符？&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;但本质上它对应的是 &lt;strong&gt;“变长编码（Variable-Length Coding）解析”&lt;/strong&gt;，而变长编码在工程中极其常见，比如：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;UTF-8 字符解析&lt;/li&gt;
&lt;li&gt;网络包头编码解析&lt;/li&gt;
&lt;li&gt;字节码指令流解析&lt;/li&gt;
&lt;li&gt;数据压缩（如 Huffman Coding）&lt;/li&gt;
&lt;li&gt;通信协议中的 Frame 解析&lt;/li&gt;
&lt;li&gt;行为序列中用跳表式结构编码的事件&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;因此，这道题不仅是算法题，更是“从左向右解析变长编码的模型题”。&lt;/p&gt;
&lt;p&gt;理解这题，就是理解大量系统底层的基础。&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="核心概念"&gt;&lt;strong&gt;核心概念&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id="1-变长编码variable-length-encoding"&gt;&lt;strong&gt;1. 变长编码（Variable-Length Encoding）&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;题目中规定了两种编码：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;1 位字符&lt;/strong&gt;：&lt;code&gt;0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;2 位字符&lt;/strong&gt;：&lt;code&gt;10&lt;/code&gt; 或 &lt;code&gt;11&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;这是一种简化的变长编码结构：字符长度取决于首位。&lt;/p&gt;
&lt;p&gt;工程中常见：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;系统&lt;/th&gt;
&lt;th&gt;变长规则&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;UTF-8&lt;/td&gt;
&lt;td&gt;1~4 字节，根据前缀位判断长度&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TLV 协议&lt;/td&gt;
&lt;td&gt;T + 长度字段决定 Value 长度&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;字节码流&lt;/td&gt;
&lt;td&gt;opcode 决定后续参数个数&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;硬件指令集&lt;/td&gt;
&lt;td&gt;有变长和固定长度两类&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;题目正是这些系统的「极简模型」。&lt;/p&gt;</description></item></channel></rss>