Heaps
Master heap data structures and priority queue implementations.
Showing 18 of 18 questions
Easy: 2 Medium: 13 Hard: 3
Question | Difficulty |
---|---|
Connect Ropes with Minimum Cost Connect ropes with minimum cost using greedy approach with heap | Easy |
Maximize Sum After K Negations Maximize array sum by flipping signs of k elements using greedy heap approach | Easy |
Find K Largest Elements Find the k largest elements from an unsorted array | Medium |
Find K Smallest Elements Find the k smallest elements from an unsorted array | Medium |
Sort Characters by Frequency Sort characters in string by frequency using heap or bucket sort | Medium |
Furthest Building You Can Reach Find furthest building reachable using optimal allocation of bricks and ladders | Medium |
Kth Largest Element in Array Find the kth largest element in an unsorted array | Medium |
Kth Smallest Element in Sorted Matrix Find kth smallest element in row and column sorted matrix using heap | Medium |
Meeting Rooms II Find minimum number of meeting rooms required using heap | Medium |
Merge K Sorted Arrays Merge k sorted arrays into one sorted array using heap | Medium |
Reduce Array Size to Half Find minimum removals to reduce array size by half using greedy heap approach | Medium |
Reorganize String Reorganize string so no two adjacent characters are the same | Medium |
Task Scheduler Schedule tasks with cooling period using greedy approach with heap | Medium |
Top K Frequent Elements Find the k most frequent elements in an array | Medium |
Ugly Numbers (Heap-based) Find the nth ugly number using heap-based approach | Medium |
Find Median from Data Stream Design data structure to find median from continuous stream of integers | Hard |
Minimum Number of Refueling Stops Find minimum refueling stops to reach target using greedy max-heap approach | Hard |
Sliding Window Median Find median in each sliding window using two heaps | Hard |