Pregunta de entrevista de Google DeepMind

Medium difficulty array coding question