# Heap / Priority Queue — Problem Tracker

[অধ্যায়ে ফিরুন](../README.md) · [সহজ ব্যাখ্যা ও ব্যবহার](../learning-guide.md) · [উৎসের তালিকা](../source-map.md)

> **লিংক পড়ার নিয়ম:** Source খুললে প্ল্যাটফর্মের মূল প্রশ্ন, Note file খুললে এই সাইটের ব্যাখ্যা ও সমাধান পাবেন। নোটগুলো আগে থেকেই লেখা আছে। `planned` হলো আপনার ব্যক্তিগত অনুশীলনের অবস্থা, নোট অনুপস্থিত থাকার চিহ্ন নয়। প্ল্যাটফর্মের কিছু প্রশ্নে লগইন বা Premium লাগতে পারে; স্থানীয় নোট সরাসরি পড়া যাবে।

এই folder টা heap-এর practice problem গুলো track করে। প্রতিটা problem-এর জন্য নিজের একটা note file থাকবে (**Note file** column-এ নাম দেওয়া), যেটা [../../templates/ds-problem-note-template.md](../../templates/ds-problem-note-template.md)-এর 24-section template দিয়ে লেখা — analogy, pattern, thinking tweak, dry run, complexity, mistakes, আর বাকি সব। উপর থেকে নিচে কাজ করো: list টা easy থেকে hard-এ সাজানো, আর পরের problem গুলো আগের problem-এর move গুলোই আবার ব্যবহার করে।

এই tracker কীভাবে ব্যবহার করবে:

1. মূল [../README.md](../README.md)-র practice list-এর link দিয়ে official statement টা পড়ো।
2. আগে নিজে problem টা attempt করো — কিছু দেখার আগে অন্তত 25 মিনিট।
3. Note file টা বানাও, template ভরো, Status-কে `solved` করো (বা সে লড়াই দিলে `revisit`)।
4. এক সপ্তাহ পরে `revisit`-status-এর problem গুলোয় আবার ফিরে এসো।

Status values: `planned` → `attempted` → `solved` / `revisit`।

## Tracker

| # | Problem | Difficulty | Source | Pattern | Inherits from | Note file | Status |
| --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | Last Stone Weight | Easy | [LeetCode 1046](https://leetcode.com/problems/last-stone-weight/) | Heap + greedy (smash two largest) | `08` heapq basics | [001-last-stone-weight.md](001-last-stone-weight.md) | planned |
| 2 | Kth Largest Element in a Stream | Easy | [LeetCode 703](https://leetcode.com/problems/kth-largest-element-in-a-stream/) | Top-K (size-k min-heap) | `08` top-K pattern | [002-kth-largest-element-in-a-stream.md](002-kth-largest-element-in-a-stream.md) | planned |
| 3 | Relative Ranks | Easy | [LeetCode 506](https://leetcode.com/problems/relative-ranks/) | Heap / sorting warm-up | `02-arrays-and-strings` sorting | [003-relative-ranks.md](003-relative-ranks.md) | planned |
| 4 | Ferris Wheel | Easy | [CSES 1090 · Ferris Wheel](https://cses.fi/problemset/task/1090) | Greedy pairing of extremes | `02-arrays-and-strings` two pointers | [004-ferris-wheel.md](004-ferris-wheel.md) | planned |
| 5 | Kth Largest Element in an Array | Medium | [LeetCode 215](https://leetcode.com/problems/kth-largest-element-in-an-array/) | Top-K | `08` top-K pattern | [005-kth-largest-element-in-an-array.md](005-kth-largest-element-in-an-array.md) | planned |
| 6 | Top K Frequent Elements | Medium | [LeetCode 347](https://leetcode.com/problems/top-k-frequent-elements/) | Top-K + counting | `05-hashing` frequency maps | [006-top-k-frequent-elements.md](006-top-k-frequent-elements.md) | planned |
| 7 | K Closest Points to Origin | Medium | [LeetCode 973](https://leetcode.com/problems/k-closest-points-to-origin/) | Top-K (max-heap of size k) | `08` top-K pattern | [007-k-closest-points-to-origin.md](007-k-closest-points-to-origin.md) | planned |
| 8 | Sort Characters By Frequency | Medium | [LeetCode 451](https://leetcode.com/problems/sort-characters-by-frequency/) | Heap + counting | `05-hashing` frequency maps | [008-sort-characters-by-frequency.md](008-sort-characters-by-frequency.md) | planned |
| 9 | Meeting Rooms II | Medium | [LeetCode 253](https://leetcode.com/problems/meeting-rooms-ii/) | Scheduling by earliest end | `02-arrays-and-strings` interval sorting | [009-meeting-rooms-ii.md](009-meeting-rooms-ii.md) | planned |
| 10 | Task Scheduler | Medium | [LeetCode 621](https://leetcode.com/problems/task-scheduler/) | Heap + greedy (most frequent first) | `05-hashing` counting | [010-task-scheduler.md](010-task-scheduler.md) | planned |
| 11 | Reorganize String | Medium | [LeetCode 767](https://leetcode.com/problems/reorganize-string/) | Heap + greedy | `05-hashing` counting | [011-reorganize-string.md](011-reorganize-string.md) | planned |
| 12 | Kth Smallest Element in a Sorted Matrix | Medium | [LeetCode 378](https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/) | K-way merge | `08` k-way merge | [012-kth-smallest-in-sorted-matrix.md](012-kth-smallest-in-sorted-matrix.md) | planned |
| 13 | Single-Threaded CPU | Medium | [LeetCode 1834](https://leetcode.com/problems/single-threaded-cpu/) | Scheduling / simulation | `04-stack-and-queue` queue thinking | [013-single-threaded-cpu.md](013-single-threaded-cpu.md) | planned |
| 14 | Furthest Building You Can Reach | Medium | [LeetCode 1642](https://leetcode.com/problems/furthest-building-you-can-reach/) | Heap + greedy (ladders on big climbs) | `08` top-K twist | [014-furthest-building-you-can-reach.md](014-furthest-building-you-can-reach.md) | planned |
| 15 | Concert Tickets | Medium | [CSES 1091 · Concert Tickets](https://cses.fi/problemset/task/1091) | Ordered multiset thinking | `05-hashing` / sorted structures | [015-concert-tickets.md](015-concert-tickets.md) | planned |
| 16 | Sliding Window Maximum (heap variant) | Hard | [LeetCode 239](https://leetcode.com/problems/sliding-window-maximum/) | Lazy deletion | `04-stack-and-queue` monotonic deque | [016-sliding-window-maximum-heap.md](016-sliding-window-maximum-heap.md) | planned |
| 17 | Merge k Sorted Lists | Hard | [LeetCode 23](https://leetcode.com/problems/merge-k-sorted-lists/) | K-way merge | `03-linked-list` + `08` k-way merge | [017-merge-k-sorted-lists.md](017-merge-k-sorted-lists.md) | planned |
| 18 | Find Median from Data Stream | Hard | [LeetCode 295](https://leetcode.com/problems/find-median-from-data-stream/) | Two heaps | `08` two-heaps pattern | [018-find-median-from-data-stream.md](018-find-median-from-data-stream.md) | planned |
| 19 | IPO | Hard | [LeetCode 502](https://leetcode.com/problems/ipo/) | Two heaps + greedy | `08` two heaps + greedy | [019-ipo.md](019-ipo.md) | planned |
| 20 | Smallest Range Covering Elements from K Lists | Hard | [LeetCode 632](https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists/) | K-way merge + window | `02-arrays-and-strings` sliding window | [020-smallest-range-k-lists.md](020-smallest-range-k-lists.md) | planned |
| 21 | Sliding Window Median | Hard | [LeetCode 480](https://leetcode.com/problems/sliding-window-median/) | Two heaps + lazy deletion | `08` two heaps + lazy deletion | [021-sliding-window-median.md](021-sliding-window-median.md) | planned |
| 22 | Trapping Rain Water II | Hard | [LeetCode 407](https://leetcode.com/problems/trapping-rain-water-ii/) | Heap + BFS from border | `09-graphs` BFS | [022-trapping-rain-water-ii.md](022-trapping-rain-water-ii.md) | planned |

## Suggested milestones (পরামর্শমতো মাইলফলক)

- #4-এর পর: notes না দেখেই `heapq` আর negate-for-max trick ব্যবহার করতে পারবে।
- #8-এর পর: top-K automatic মনে হওয়া উচিত — জোরে বলো, "min-heap guards the club door"।
- #15-এর পর: একটা greedy idea-র সাথে heap জোড়া লাগাতে পারবে, নিজে নিজেই।
- #22-এর পর: heap + আরেকটা structure (window, list, grid BFS) আর ভয় দেখায় না। এগিয়ে যাও [../../09-graphs/](../../09-graphs/README.md)-এ — Dijkstra অপেক্ষা করছে, আর সে আসলে এই heap-টাই, graph-এর পোশাক পরে।
