Problem Description
Given a sorted array A containing N integers both positive and negative.
You need to create another array containing the squares of all the elements in A and return it in non-decreasing order.
1 <= N <= 105.
-103 <= A[i] <= 103
First and only argument is an integer array A.
Return a integer array as described in the problem above.
Input 1:
A = [-6, -3, -1, 2, 4, 5]
Input 2:
A = [-5, -4, -2, 0, 1]
Output 1:
[1, 4, 9, 16, 25, 36]
Output 2:
[0, 1, 4, 16, 25]
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.