Pregunta de entrevista de Google

I was asked to solve a data-structure problem in Python involving manipulating arrays and using an efficient algorithm.