Squares of a Sorted Array

Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.

Constraints

  • 1 <= nums.length <= 10^4
  • -10^4 <= nums[i] <= 10^4
  • nums is sorted in non-decreasing order.
Saving… · 3 lines
class Solution:
def squaresOfSortedArray(self, nums: List[int]) -> List[int]:
pass
Console

Click Run to execute sample tests.