LeetCode 977: Squares of a Sorted Array.
Asked in the Phone screen stage.
Given a nondecreasing array of integers nums, return a new array containing the square of every value, also in nondecreasing order. Implement sorted_squares(nums) without relying on a general-purpose sorting operation.
nums, a nondecreasing list of integers.def sorted_squares(nums):