Question d’entretien chez Google

Typical algorithm question on CS - you need to know graphs for this.