Pergunta de entrevista da empresa MongoDB

Square all the numbers in a sorted array and maintain sortedness