Pergunta de entrevista da empresa Amazon

Minimum spanning tree and another graph related problem