Pregunta de entrevista de Booking Holdings

Graph traversal problem and some theory