Applied Intuition interview question

LC style question based on heap data structure.