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]More Goldman Sachs Phone Screen questions
- House Robber IIIPHONE SCREEN · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · Seen Nov 2026
- Best Average Student ScorePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Check a Complete Binary TreePHONE SCREEN · Seen Oct 2026
- Meeting RoomsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Count Staircase WaysPHONE SCREEN · Seen Oct 2026
- Is a Power of TenPHONE SCREEN · Seen Oct 2026
- Minimum Traveling Salesperson TourPHONE SCREEN · Seen Oct 2026
- Square Root with Newton IterationPHONE SCREEN · Seen Oct 2026
- First Non-Repeating CharacterPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Squares of a Sorted ArrayInstacart · PHONE SCREENInstacart interview questions
- Assign CookiesAmazon · PHONE SCREEN
- Merge Two Sorted ArraysCapgemini · PHONE SCREENCapgemini interview questions
- Squares of a Sorted ArrayStryker · PHONE SCREEN
- 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 Two Sorted ArraysZillow · PHONE SCREENZillow interview questions
- Merge Sorted Arrays with DuplicatesMygate · PHONE SCREENMygate interview questions