Lesson 48 of 73 1 min

Heaps: Curated Practice Problems

A hand-picked list of 10 essential LeetCode problems to master Priority Queues and partial sorting.

Key Patterns to Master

  1. Top K Elements: Maintaining a heap of size $K$.
  2. Two Heaps: For tracking medians or balanced sets.
  3. K-way Merge: Combining multiple sorted inputs.

Hand-Picked Problems

Problem Difficulty Key Pattern
Kth Largest Element in an Array Medium Min-Heap of size K
Top K Frequent Elements Medium Frequency Map + Heap
Merge k Sorted Lists Hard Head Tracking
Find Median from Data Stream Hard Max-Heap + Min-Heap
K Closest Points to Origin Medium Distance-based Heap
Reorganize String Medium Max Freq + Cooldown
Task Scheduler Medium Greedy + Priority Queue
Kth Largest Element in a Stream Easy Streaming Heap
Smallest Range Covering Elements from K Lists Hard Multi-list Sliding Heap
Meeting Rooms II Medium Chronological Heap

Interview Tip

Always mention the Heapify operation ($O(n)$) if you are building a heap from an entire array at once. 埋

Want to track your progress?

Sign in to save your progress, track completed lessons, and pick up where you left off.