#K93722. Sorted Squares
Sorted Squares
Sorted Squares
Given a list of integers sorted in non-decreasing order, return a list of the squares of each number sorted in non-decreasing order. Formally, if \(nums = [a_1, a_2, \dots, a_n]\), then find the sequence \([a_1^2, a_2^2, \dots, a_n^2]\) arranged in non-decreasing order.
inputFormat
The first line contains an integer (n), representing the number of elements. The second line contains (n) space-separated integers sorted in non-decreasing order.
outputFormat
Output a single line with the squares of the integers, sorted in non-decreasing order and separated by a space.## sample
5
-4 -1 0 3 10
0 1 9 16 100
</p>