dsa2 min read
Minimum Cost to Connect Sticks
Find minimum cost to connect all sticks by greedily always merging the two shortest sticks first.
Read →
1575 articles
Find minimum cost to connect all sticks by greedily always merging the two shortest sticks first.
Maximize capital after k IPO investments by greedily picking the highest profit project among affordable ones.
Check if a car can pick up all passengers by processing start/end events with a sorted timeline or heap.
Greedily use ladders for the largest climbs and bricks for smaller gaps, managed with a min-heap of ladder sizes.
Assign tasks to available servers using two heaps: one for free servers and one for busy servers sorted by free time.