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 →
1575 articles
Find the kth largest level sum in a binary tree using BFS to compute level sums then sorting or using a heap.
Minimize total hiring cost by always choosing the cheapest candidate from the first or last p candidates using two min-heaps.
Design a seat manager that reserves the lowest numbered available seat and unreserves seats using a min-heap.
Track stock prices with corrections by maintaining a sorted multiset and a timestamp-to-price map.
Find the minimum number of elements to remove to reduce array size by half by greedily removing most frequent elements.