Squares of a Sorted Array
Updated
Problem statement
Given an integer array nums sorted in nondecreasing order, square every value and return the resulting values in nondecreasing order.
Function
sortedSquares(nums: int[]) → int[]Examples
Example 1
nums = [-4,-1,0,3,10]return = [0,1,9,16,100]Example 2
nums = [-7,-3,2,3,11]return = [4,9,9,49,121]Similar questions at other companies
- Squares of a Sorted ArrayInstacart · PHONE SCREENInstacart interview questions
- Merge Two Sorted ArraysCapgemini · PHONE SCREENCapgemini interview questions
- Squares of a Sorted ArrayGoldman Sachs · PHONE SCREENGoldman Sachs interview questions
- Merge Into the Zero-Padded ArrayAdobe · PHONE SCREENAdobe interview questions
- Three Partition ArrayMicrosoft · PHONE SCREENMicrosoft interview questions
- Sorted Squares in Descending OrderWhatNot · PHONE SCREENWhatNot interview questions
- Assign CookiesExpedia · PHONE SCREEN · ONSITE INTERVIEWExpedia interview questions
- Merge Sorted Arrays with DuplicatesMygate · PHONE SCREENMygate interview questions
- 3SumAmazon · PHONE SCREEN
- Sort Ones, Twos, and Threes In PlaceAgoda · PHONE SCREEN · ONSITE INTERVIEWAgoda interview questions