Pregunta de entrevista de C3 AI

Graph problem which I have not well prepared.