Squares of a Sorted Array
Updated Feb 24, 2026
Problem
Return sorted squares of each number.
Constraints
1 <= nums.length <= 10^4
Examples
Example 1
Input:
{"nums": [-4, -1, 0, 3, 10]}
Output:
[0, 1, 9, 16, 100]
Function Signature
def sortedSquares(self, nums: list[int]) -> list[int]
How to Submit
Implement a Solution class with a sortedSquares method.
Your method will be called with the input parameters and should return the answer.