Amazon interview question

Question about min/max heaps and optimizing runtime