Pregunta de entrevista de Pegasystems

Coding question was asked on graphs.