Amazon Interview Question

Question about min/max heaps and optimizing runtime