Pregunta de entrevista de Microsoft

Array question based on simple maths DFS graph question