Min-heap

6 articles

dsa2 min read

Furthest Building You Can Reach

Greedily use ladders for the largest climbs and bricks for smaller gaps, managed with a min-heap of ladder sizes.

Read →
dsa3 min read

Trapping Rain Water II

Calculate trapped water in a 3D height map using BFS with a min-heap to process cells from shortest boundary inward.

Read →
dsa2 min read

Maximum Performance of a Team

Maximize team performance (sum of speeds * min efficiency) by sorting by efficiency and using a min-heap on speeds.

Read →
dsa1 min read

Seat Reservation Manager

Design a seat manager that reserves the lowest numbered available seat and unreserves seats using a min-heap.

Read →