IMBUE interview question

Basic combinatronics and BFS/MST question.