Pergunta de entrevista da empresa Infosys

Coding question on heap and graph.