Mapfre Interview Question

Explain how to solve this with a heap?