Pergunta de entrevista da empresa Microsoft

Array question based on simple maths DFS graph question