Easy · Binary Search
Squares of a Sorted Array
Given an integer array nums sorted in non-decreasing order, return an array of the squares of its values, also sorted in non-decreasing order.
Examples
Example 1
[-4,-1,0,3,10]Output: [0, 1, 9, 16, 100]
Example 2
[-7,-3,2,3,11]Output: [4, 9, 9, 49, 121]
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.