<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Sliding Window on prometheus</title><link>https://new.halfrost.com/zh/tags/sliding-window/</link><description>Recent content in Sliding Window on prometheus</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><copyright>halfrost</copyright><lastBuildDate>Sat, 14 Dec 2019 11:46:00 +0000</lastBuildDate><atom:link href="https://new.halfrost.com/zh/tags/sliding-window/index.xml" rel="self" type="application/rss+xml"/><item><title>Algorithm in LeetCode —— Sliding Window</title><link>https://new.halfrost.com/zh/sliding_window/</link><pubDate>Sat, 14 Dec 2019 11:46:00 +0000</pubDate><guid>https://new.halfrost.com/zh/sliding_window/</guid><description>Sliding Window 的 Tips: 双指针滑动窗口的经典写法。右指针不断往右移，移动到不能往右移动为止(具体条件根据题目而定)。当右指针到最右边以后，开始挪动左指针，释放窗口左边界。第 3 题，第 76 题，第 209 题，第 424 题，第 438 题，第 567 题，第 713 题，第 763 题，第 845 题，第 881 题，第 904 题，第 978 题，第 992 题，第 1004 题，第 1040 题，第 1052 题。 left, right := 0, -1 for left &amp;lt; len(s) { if right+1 &amp;lt; len(s) &amp;amp;&amp;amp; freq[s[right+1]-&amp;#39;a&amp;#39;] == 0 { freq[s[right+1]-&amp;#39;a&amp;#39;]++ right++ } else { freq[s[left]-&amp;#39;a&amp;#39;]-- left++ } result = max(result, right-left+1) } 滑动窗口经典题。第 239 题，第 480 题。 Title Solution Difficulty Time Space 收藏 3.</description></item></channel></rss>