← 返回 google 的题目列表Squares of a Sorted Array
类型:online_judge
Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.
Input
nums: An array of integers sorted in non-decreasing order, with length n such that 1 <= n <= 10^4.
The value of nums[i] lies between -10^4 and 10^4.
Output
Return an array of the squares of each number sorted in non-decreasing order.
Example
Input
[-4, -1, 0, 3, 10]