<?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>字符串 on Jeanphilo Blog</title><link>https://jeanphilogong.github.io/jeanblog/zh/tags/%E5%AD%97%E7%AC%A6%E4%B8%B2/</link><description>Recent content in 字符串 on Jeanphilo Blog</description><generator>Hugo -- 0.168.0</generator><language>zh-cn</language><lastBuildDate>Sat, 10 Oct 2026 10:00:00 +0800</lastBuildDate><atom:link href="https://jeanphilogong.github.io/jeanblog/zh/tags/%E5%AD%97%E7%AC%A6%E4%B8%B2/index.xml" rel="self" type="application/rss+xml"/><item><title>LeetCode 49：字母异位词分组，从逐组比较到构造分组键</title><link>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/49-group-anagrams/</link><pubDate>Sat, 10 Oct 2026 10:00:00 +0800</pubDate><guid>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/49-group-anagrams/</guid><description>用 Python 从两个字符串的异位词判断出发，先写出逐组扫描的正确解，再推导排序键与字符计数键，理解哈希表分组为什么成立。</description></item><item><title>LeetCode 609：在文件系统中查找重复文件，从解析记录到按内容分组</title><link>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/609-find-duplicate-file-in-system/</link><pubDate>Sat, 10 Oct 2026 10:00:00 +0800</pubDate><guid>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/609-find-duplicate-file-in-system/</guid><description>逐步解决 LeetCode 609：解析目录与文件描述，写出两两比较的正确基线，再按内容哈希分组，并分析路径拼接成本和真实文件系统的边界。</description></item><item><title>LeetCode 139：单词拆分，从前缀是否可达开始</title><link>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/139-word-break/</link><pubDate>Tue, 22 Sep 2026 12:00:00 +0800</pubDate><guid>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/139-word-break/</guid><description>&lt;h2 id="题目要求"&gt;题目要求&lt;/h2&gt;
&lt;h3 id="输入输出"&gt;输入输出&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;输入：字符串 &lt;code&gt;s&lt;/code&gt; 和字符串列表 &lt;code&gt;wordDict&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;wordDict&lt;/code&gt; 中的每个元素都是一个可以使用的单词；同一个单词可以重复使用&lt;/li&gt;
&lt;li&gt;输出：如果 &lt;code&gt;s&lt;/code&gt; 可以被拆成一个或多个字典单词，返回 &lt;code&gt;True&lt;/code&gt;；否则返回 &lt;code&gt;False&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;拆分必须覆盖整个字符串，不能跳过字符，也不能改变字符顺序&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="示例"&gt;示例&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;输入：s = &amp;#34;leetcode&amp;#34;, wordDict = [&amp;#34;leet&amp;#34;, &amp;#34;code&amp;#34;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;输出：True
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;解释：&amp;#34;leetcode&amp;#34; 可以拆成 &amp;#34;leet&amp;#34; + &amp;#34;code&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;输入：s = &amp;#34;applepenapple&amp;#34;, wordDict = [&amp;#34;apple&amp;#34;, &amp;#34;pen&amp;#34;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;输出：True
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;解释：&amp;#34;apple&amp;#34; + &amp;#34;pen&amp;#34; + &amp;#34;apple&amp;#34;；同一个单词可以重复使用
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;输入：s = &amp;#34;catsandog&amp;#34;, wordDict = [&amp;#34;cats&amp;#34;, &amp;#34;dog&amp;#34;, &amp;#34;sand&amp;#34;, &amp;#34;and&amp;#34;, &amp;#34;cat&amp;#34;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;输出：False
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;解释：前面可以拼出一些片段，但最后不能覆盖完整字符串
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="约束"&gt;约束&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;1 &amp;lt;= s.length &amp;lt;= 300&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;1 &amp;lt;= wordDict.length &amp;lt;= 1000&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;1 &amp;lt;= wordDict[i].length &amp;lt;= 20&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;s&lt;/code&gt; 和 &lt;code&gt;wordDict[i]&lt;/code&gt; 只包含小写英文字母&lt;/li&gt;
&lt;li&gt;&lt;code&gt;wordDict&lt;/code&gt; 中的单词互不相同&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="step-1先让已完成的前缀变得可见"&gt;Step 1：先让“已完成的前缀”变得可见&lt;/h2&gt;
&lt;p&gt;先只问一个具体问题：对于 &lt;code&gt;s = &amp;quot;leetcode&amp;quot;&lt;/code&gt;，在确认整串能否拆开之前，我们能不能先记录“已经拆完了哪一段”？&lt;/p&gt;</description></item><item><title>Python 字符串为什么不可变：从 replace 到变量重绑定</title><link>https://jeanphilogong.github.io/jeanblog/zh/dev/python/python-string-immutability/</link><pubDate>Fri, 28 Aug 2026 00:00:00 +0000</pubDate><guid>https://jeanphilogong.github.io/jeanblog/zh/dev/python/python-string-immutability/</guid><description>用可运行示例解释 Python str 的不可变性，区分字符串对象不变与变量重新赋值，并说明 replace、切片、+= 和循环拼接的真实行为。</description></item><item><title>LeetCode 20：有效的括号，为什么数量相同仍然无效</title><link>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/20-valid-parentheses/</link><pubDate>Fri, 21 Aug 2026 00:00:00 +0000</pubDate><guid>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/20-valid-parentheses/</guid><description>从反例 ([)] 出发，区分括号数量相同与括号类型、闭合顺序真正匹配，为 LeetCode 20 建立可验证的题意基础。</description></item><item><title>LeetCode 394：字符串解码，如何保存并恢复嵌套上下文</title><link>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/394-decode-string/</link><pubDate>Fri, 21 Aug 2026 00:00:00 +0000</pubDate><guid>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/394-decode-string/</guid><description>从嵌套编码会打断外层解码的压力出发，逐步构建 LeetCode 394 Decode String。</description></item><item><title>LeetCode 208：实现 Trie（前缀树）模板题解析</title><link>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/trie/208-implement-trie-prefix-tree/</link><pubDate>Wed, 24 Jun 2026 17:38:48 +0800</pubDate><guid>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/trie/208-implement-trie-prefix-tree/</guid><description>LeetCode 208 Implement Trie 是 Trie 模板题，核心是按固定接口实现 insert、search 和 startsWith。</description></item><item><title>Trie 模板：从节点字段到插入查询 invariant</title><link>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/trie/trie-template/</link><pubDate>Wed, 24 Jun 2026 17:38:48 +0800</pubDate><guid>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/trie/trie-template/</guid><description>从零搭一个 Trie 模板，重点理解每个节点存什么、children 怎么走、is_end 为什么需要，以及 insert/search 的循环 invariant。</description></item><item><title>Hot100：分割回文串（Palindrome Partitioning）回溯 + 回文预处理 ACERS 解析</title><link>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/backtracking/131-palindrome-partitioning/</link><pubDate>Sun, 19 Apr 2026 00:09:28 +0800</pubDate><guid>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/backtracking/131-palindrome-partitioning/</guid><description>围绕 LeetCode 131 分割回文串，讲清“切分枚举 + 回文区间预处理”的完整推导过程，帮助你把字符串分割型回溯真正写稳。</description></item><item><title>Hot100：电话号码的字母组合（Letter Combinations of a Phone Number）固定层数 DFS ACERS 解析</title><link>https://jeanphilogong.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://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/backtracking/17-letter-combinations-of-a-phone-number/</guid><description>围绕 LeetCode 17 讲清固定层数 DFS、数字到字母映射与多语言实现。</description></item><item><title>LeetCode 76：最小覆盖子串（Minimum Window Substring）滑动窗口 ACERS 解析</title><link>https://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/hot100/76-minimum-window-substring/</link><pubDate>Tue, 20 Jan 2026 21:59:19 +0800</pubDate><guid>https://jeanphilogong.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://jeanphilogong.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://jeanphilogong.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://jeanphilogong.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://jeanphilogong.github.io/jeanblog/zh/alg/leetcode/1513-number-of-substrings-with-only-ones/</guid><description>用连续段在线统计在 O(n) 时间计算仅含 1 的子串数量，含工程场景与多语言实现。</description></item><item><title>最少涂色次数拿到 k 个连续黑块：滑动窗口的极简解法（LeetCode 2379）</title><link>https://jeanphilogong.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://jeanphilogong.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></channel></rss>