Domanda di colloquio di Apple

A normal graph problem usually taught in discrete math class