Pergunta de entrevista da empresa X

array number manipulation and returning after simple computation