Pregunta de entrevista de Blu Smart

It was a array based question and a graph based easy question.