977. Squares of a Sorted Array
Last updated
Last updated
Given an array of integers A
sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order.
Example 1:
Sort
Time Complexity: O(NlogN), where NN is the length of A
.
Space Complexity: O(N).
Tow pointer
Time Complexity: O(N), where N is the length of A
.
Space Complexity: O(N).
note: 1 <= A.length <= 10000