Connect Ropes with Minimum Cost
Connect ropes with minimum cost using greedy approach with heap
Find K Largest Elements
Find the k largest elements from an unsorted array
Find K Smallest Elements
Find the k smallest elements from an unsorted array
Find Median from Data Stream
Design data structure to find median from continuous stream of integers
Furthest Building You Can Reach
Find furthest building reachable using optimal allocation of bricks and ladders
Kth Largest Element in Array
Find the kth largest element in an unsorted array
Kth Smallest Element in Sorted Matrix
Find kth smallest element in row and column sorted matrix using heap
Max Stack
Design a stack that supports push, pop, top, peekMax, and popMax operations
Maximize Sum After K Negations
Maximize array sum by flipping signs of k elements using greedy heap approach
Meeting Rooms II
Find minimum number of meeting rooms required using heap
Merge K Sorted Arrays
Merge k sorted arrays into one sorted array using heap
Merge k Sorted Linked Lists
Merge k sorted linked lists into one sorted linked list
Minimum Number of Refueling Stops
Find minimum refueling stops to reach target using greedy max-heap approach
Reduce Array Size to Half
Find minimum removals to reduce array size by half using greedy heap approach
Reorganize String
Reorganize string so no two adjacent characters are the same
Sliding Window Maximum
Find the maximum element in each sliding window of size k
Sliding Window Median
Find median in each sliding window using two heaps
Sort Characters by Frequency
Sort characters in string by frequency using heap or bucket sort
Task Scheduler
Schedule tasks with cooling period using greedy approach with heap
Top K Frequent Elements
Find the k most frequent elements in an array
Ugly Numbers (Heap-based)
Find the nth ugly number using heap-based approach