Pregunta de entrevista de Coursera

array question and then something with BFS