Pregunta de entrevista de Amazon

1) One programming question on graph