<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>字符串 on Chen Kai Blog</title><link>https://www.chenk.top/zh/tags/%E5%AD%97%E7%AC%A6%E4%B8%B2/</link><description>Recent content in 字符串 on Chen Kai Blog</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Wed, 15 Jun 2022 09:00:00 +0000</lastBuildDate><atom:link href="https://www.chenk.top/zh/tags/%E5%AD%97%E7%AC%A6%E4%B8%B2/index.xml" rel="self" type="application/rss+xml"/><item><title>LeetCode（四）：滑动窗口技巧</title><link>https://www.chenk.top/zh/leetcode/04-%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3%E6%8A%80%E5%B7%A7/</link><pubDate>Wed, 15 Jun 2022 09:00:00 +0000</pubDate><guid>https://www.chenk.top/zh/leetcode/04-%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3%E6%8A%80%E5%B7%A7/</guid><description>&lt;p>如果你曾经写过双重 &lt;code>for&lt;/code> 循环来遍历所有连续子数组，那么&lt;strong>滑动窗口&lt;/strong>很可能就是你缺失的关键优化。它通过&lt;strong>复用已计算的结果&lt;/strong>，将原本 &lt;span class="math-inline">$O(nk)$&lt;/span>
 或 &lt;span class="math-inline">$O(n^2)$&lt;/span>
 的暴力扫描压缩为一次线性遍历。本文将从基本原理出发，深入剖析这一技巧，并通过四道经典 LeetCode 题目加以演练，最后还会介绍其单调队列变体。&lt;/p></description></item></channel></rss>