All Posts

1575 articles

dsa1 min read

Kth Largest Sum in a Binary Tree

Find the kth largest level sum in a binary tree using BFS to compute level sums then sorting or using a heap.

Read →
dsa2 min read

Total Cost to Hire K Workers

Minimize total hiring cost by always choosing the cheapest candidate from the first or last p candidates using two min-heaps.

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 →
dsa1 min read

Stock Price Fluctuation

Track stock prices with corrections by maintaining a sorted multiset and a timestamp-to-price map.

Read →
dsa1 min read

Reduce Array Size to At Least Half

Find the minimum number of elements to remove to reduce array size by half by greedily removing most frequent elements.

Read →
Page 134 of 315