Pregunta de entrevista de Amazon

Question about min/max heaps and optimizing runtime