Pregunta de entrevista de Smooth Commerce

I solved one algorithm about arrays