Pergunta de entrevista da empresa Google

Question based on array and vectors and then optimization.