Search⌘ K
AI Features

Solution: Squares of a Sorted Array

Solution: Squares of a Sorted Array gives you a non-decreasing array that may contain negatives. Return a new array of its values squared, sorted in non-decreasing order.

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:

  • 1≤1 ...