<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Heap on</title><link>https://h30306.github.io/blog/tags/heap/</link><description>Recent content in Heap on</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>hwork0511@gmail.com (Wei Yi Chung)</managingEditor><webMaster>hwork0511@gmail.com (Wei Yi Chung)</webMaster><copyright>© 2026 Wei Yi Chung</copyright><lastBuildDate>Tue, 20 Oct 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://h30306.github.io/blog/tags/heap/index.xml" rel="self" type="application/rss+xml"/><item><title>Heap and Priority Queue</title><link>https://h30306.github.io/blog/algorithm/heap/</link><pubDate>Tue, 20 Oct 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/algorithm/heap/</guid><description>heapq basics, Top-K, lazy deletion, two heaps, k-way merge, sweep line, and Dijkstra</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/algorithm/heap/featured.png"/></item><item><title>LeetCode 23: Merge k Sorted Lists</title><link>https://h30306.github.io/blog/leetcode/leetcode-23/</link><pubDate>Tue, 20 Oct 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-23/</guid><description>LeetCode 23 note: a heap that holds only k heads, and divide-and-conquer pairwise merging</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-23/featured.png"/></item><item><title>LeetCode 253: Meeting Rooms II</title><link>https://h30306.github.io/blog/leetcode/leetcode-253/</link><pubDate>Thu, 15 Oct 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-253/</guid><description>LeetCode 253 note: a heap of end times for running meetings; half-open intervals need &amp;lt;=</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-253/featured.png"/></item><item><title>LeetCode 716: Max Stack</title><link>https://h30306.github.io/blog/leetcode/leetcode-716/</link><pubDate>Mon, 14 Sep 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-716/</guid><description>LeetCode 716 note: store unique ids on both the stack and the heap, record deletions by id, and discard deleted entries lazily; tracking values cannot tell duplicates apart</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-716/featured.png"/></item><item><title>LeetCode 2973: Find Number of Coins to Place in Tree Nodes</title><link>https://h30306.github.io/blog/leetcode/leetcode-2973/</link><pubDate>Sat, 12 Sep 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-2973/</guid><description>LeetCode 2973 note: the max product of three is either the three largest or the two smallest times the largest, so each subtree returns only its 2 smallest and 3 largest values, merged in post-order</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-2973/featured.png"/></item><item><title>LeetCode 4046: Minimum Cost Path With At Most K Turns</title><link>https://h30306.github.io/blog/leetcode/leetcode-4046/</link><pubDate>Fri, 11 Sep 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-4046/</guid><description>LeetCode 4046 note: Dijkstra with the last direction and the turns used in the state; for the same cell and direction, an earlier pop is cheaper, and if it also used fewer turns it dominates later states</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-4046/featured.png"/></item><item><title>LeetCode 1425: Constrained Subsequence Sum</title><link>https://h30306.github.io/blog/leetcode/leetcode-1425/</link><pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-1425/</guid><description>LeetCode 1425 note: dp[i] = nums[i] + max(0, max of the previous k dp values); that max is a sliding window maximum, available in O(1) from a monotonic deque</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-1425/featured.png"/></item><item><title>LeetCode 1354: Construct Target Array With Multiple Sums</title><link>https://h30306.github.io/blog/leetcode/leetcode-1354/</link><pubDate>Mon, 07 Sep 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-1354/</guid><description>LeetCode 1354 note: work backwards, since the maximum was set last; jump with a modulo when the gap is large</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-1354/featured.png"/></item><item><title>LeetCode 499: The Maze III</title><link>https://h30306.github.io/blog/leetcode/leetcode-499/</link><pubDate>Sun, 06 Sep 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-499/</guid><description>LeetCode 499 note: Dijkstra prioritized by (distance, path string), and the ball stops when it rolls over the hole</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-499/featured.png"/></item><item><title>LeetCode 2163: Minimum Difference in Sums After Removal of Elements</title><link>https://h30306.github.io/blog/leetcode/leetcode-2163/</link><pubDate>Sat, 05 Sep 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-2163/</guid><description>LeetCode 2163 note: try every boundary k between the two parts; the left takes the n smallest of nums[:k] (a max-heap) and the right the n largest of nums[k:] (a min-heap), one prefix and one suffix pass</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-2163/featured.png"/></item><item><title>LeetCode 2102: Sequentially Ordinal Rank Tracker</title><link>https://h30306.github.io/blog/leetcode/leetcode-2102/</link><pubDate>Sat, 01 Aug 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-2102/</guid><description>LeetCode 2102 note: two heaps for &amp;ldquo;top k&amp;rdquo; and &amp;ldquo;the rest&amp;rdquo;, with a custom &lt;strong>lt&lt;/strong> for reversed string order</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-2102/featured.png"/></item><item><title>LeetCode 1878: Get Biggest Three Rhombus Sums in a Grid</title><link>https://h30306.github.io/blog/leetcode/leetcode-1878/</link><pubDate>Tue, 23 Jun 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-1878/</guid><description>LeetCode 1878 note: enumerate every top vertex and size, walk the four edges, and keep the three largest distinct sums</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-1878/featured.png"/></item><item><title>LeetCode 759: Employee Free Time</title><link>https://h30306.github.io/blog/leetcode/leetcode-759/</link><pubDate>Sun, 03 May 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-759/</guid><description>LeetCode 759 note: k-way merge all work intervals by start; any gap after the latest end so far is common free time</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-759/featured.png"/></item><item><title>LeetCode 1514: Path with Maximum Probability</title><link>https://h30306.github.io/blog/leetcode/leetcode-1514/</link><pubDate>Fri, 17 Apr 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-1514/</guid><description>LeetCode 1514 note: multiplying probabilities only shrinks them, so Dijkstra applies; prune with &amp;lt;=</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-1514/featured.png"/></item><item><title>LeetCode 3885: Design Event Manager</title><link>https://h30306.github.io/blog/leetcode/leetcode-3885/</link><pubDate>Sun, 29 Mar 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-3885/</guid><description>LeetCode 3885 note: a dict of current priorities plus a max-heap with lazy deletion, validated on pop</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-3885/featured.png"/></item><item><title>LeetCode 2054: Two Best Non-Overlapping Events</title><link>https://h30306.github.io/blog/leetcode/leetcode-2054/</link><pubDate>Wed, 04 Feb 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-2054/</guid><description>LeetCode 2054 note: with at most two events, pair each event with the most valuable event that ends before it starts; sort by end time and use a prefix max with binary search</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-2054/featured.png"/></item><item><title>LeetCode 3815: Design Auction System</title><link>https://h30306.github.io/blog/leetcode/leetcode-3815/</link><pubDate>Sun, 18 Jan 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-3815/</guid><description>LeetCode 3815 note: one max-heap per item, push a new entry on every bid change, and drop stale entries on query</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-3815/featured.png"/></item><item><title>LeetCode 632: Smallest Range Covering Elements from K Lists</title><link>https://h30306.github.io/blog/leetcode/leetcode-632/</link><pubDate>Sun, 18 Jan 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-632/</guid><description>LeetCode 632 note: a heap of each list&amp;rsquo;s current element plus the running maximum; always advance the smallest</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-632/featured.png"/></item><item><title>LeetCode 1696: Jump Game VI</title><link>https://h30306.github.io/blog/leetcode/leetcode-1696/</link><pubDate>Sun, 10 Aug 2025 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-1696/</guid><description>LeetCode 1696 note: dp[i] = nums[i] + max of the previous k dp values, with that max kept by a monotonic deque in O(n)</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-1696/featured.png"/></item><item><title>LeetCode 2402: Meeting Rooms III</title><link>https://h30306.github.io/blog/leetcode/leetcode-2402/</link><pubDate>Thu, 17 Jul 2025 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-2402/</guid><description>LeetCode 2402 note: one heap for free rooms and one for busy rooms; a delayed meeting keeps its original length</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-2402/featured.png"/></item><item><title>LeetCode 1353: Maximum Number of Events That Can Be Attended</title><link>https://h30306.github.io/blog/leetcode/leetcode-1353/</link><pubDate>Mon, 07 Jul 2025 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-1353/</guid><description>LeetCode 1353 note: each day, attend the event that ends earliest, using a min-heap of end days</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-1353/featured.png"/></item><item><title>LeetCode 3607: Power Grid Maintenance</title><link>https://h30306.github.io/blog/leetcode/leetcode-3607/</link><pubDate>Sun, 06 Jul 2025 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-3607/</guid><description>LeetCode 3607 note: Union-Find groups, one min-heap per group, and lazy deletion for offline stations</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-3607/featured.png"/></item></channel></rss>