Pregunta de entrevista de Google

Based on the concepts of priority queue