Squares of a Sorted Array
Given an integer array sorted in non-decreasing order (which may contain negative numbers), return a new array of the squares of each number, also sorted in non-decreasing order. Aim for an O(n) solution by leveraging the sorted input — for example, by using a two-pointer approach to merge the largest squares from both ends of the array.
Asked at:
Uber
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early June, 2026
Uber
Senior
It was slightly modified where you need to sort the array based on their square values, but the result array should have original numbers only and not their squares
Late May, 2026
Uber
Staff
Late April, 2026
Uber
Senior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.