Take Gifts From the Richest Pile
An Easy coding interview problem in the Heap / Priority Queue pattern.
Likely pattern
Always pull the current best element in log time.
Recognition cue: Top K, K closest, running median, or repeatedly taking the smallest / largest.
- Learn first
- Do not confuse it with
Topics
- Array
- Heap (Priority Queue)
- Simulation
Practise Heap / Priority Queue next
- 1Easy
- 2Easy
- 3Easy
- 4Easy
- 5Easy
- 6Easy
- 7Easy
- 8Medium