Pregunta de entrevista de Tutor Intelligence

Priority queue based leetcode medium question.