Heap
LeetCode 759: Employee Free Time
·2 mins
LeetCode
Hard
Heap
K-Way-Merge
Intervals
Sweep-Line
LeetCode 759 note: k-way merge all work intervals by start; any gap after the latest end so far is common free time
LeetCode 1514: Path with Maximum Probability
·3 mins
LeetCode
Medium
Graph
Dijkstra
Shortest-Path
Heap
LeetCode 1514 note: multiplying probabilities only shrinks them, so Dijkstra applies; prune with <=
LeetCode 3885: Design Event Manager
·2 mins
LeetCode
Medium
Heap
Design
Hash-Map
Lazy-Deletion
LeetCode 3885 note: a dict of current priorities plus a max-heap with lazy deletion, validated on pop
LeetCode 2054: Two Best Non-Overlapping Events
·2 mins
LeetCode
Medium
Dynamic-Programming
Binary-Search
Sorting
Heap
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
LeetCode 632: Smallest Range Covering Elements from K Lists
·3 mins
LeetCode
Hard
Heap
K-Way-Merge
Sliding-Window
LeetCode 632 note: a heap of each list’s current element plus the running maximum; always advance the smallest
LeetCode 3815: Design Auction System
·3 mins
LeetCode
Medium
Heap
Design
Hash-Map
Lazy-Deletion
LeetCode 3815 note: one max-heap per item, push a new entry on every bid change, and drop stale entries on query
LeetCode 1696: Jump Game VI
·2 mins
LeetCode
Medium
Dynamic-Programming
Monotonic-Queue
Queue
Heap
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)
LeetCode 2402: Meeting Rooms III
·3 mins
LeetCode
Hard
Heap
Sorting
Simulation
Intervals
LeetCode 2402 note: one heap for free rooms and one for busy rooms; a delayed meeting keeps its original length
LeetCode 1353: Maximum Number of Events That Can Be Attended
·2 mins
LeetCode
Medium
Heap
Greedy
Sorting
LeetCode 1353 note: each day, attend the event that ends earliest, using a min-heap of end days
LeetCode 3607: Power Grid Maintenance
·3 mins
LeetCode
Medium
Heap
Union-Find
Graph
Lazy-Deletion
LeetCode 3607 note: Union-Find groups, one min-heap per group, and lazy deletion for offline stations