Applied Intuition Interview Question

LC style question based on heap data structure.