Pregunta de entrevista de IMBUE

Basic combinatronics and BFS/MST question.