Solution: Squares of a Sorted Array
Explore how to apply the two pointers pattern to efficiently return a new sorted array of squared values from an input sorted array. Learn to compare absolute values from both ends, fill the result in place, and achieve a linear time and constant extra space solution.
We'll cover the following...
We'll cover the following...
Statement
You are given an integer array, nums, sorted in non-decreasing order. Your task is to return a new array containing the squares of each number, also sorted in non-decreasing order.
Constraints:
...