FastPrepSquares of a Sorted Array
Problems/Squares of a Sorted Array

Squares of a Sorted Array

Bloomberg LP logoBloomberg LP● EasyNEW GRADONSITE INTERVIEW

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks to square a sorted sequence and return the squares in sorted order during a Bloomberg new-grad virtual onsite. This practice version uses the standard two-pointer Squares of a Sorted Array contract.

Given an integer array nums sorted in nondecreasing order, return an array containing the square of every value, also sorted in nondecreasing order.

Function

sortedSquares(nums: int[]) → int[]

Examples

Example 1

nums = [-4,-1,0,3,10]return = [0,1,9,16,100]

Squaring gives [16,1,0,9,100], which sorts to the returned array.

Example 2

nums = [-7,-3,2,3,11]return = [4,9,9,49,121]

The negative values contribute large squares from the left end.

Example 3

nums = []return = []

An empty input has no squares.

Constraints

  • 0 <= nums.length <= 100000.
  • -10000 <= nums[i] <= 10000.
  • nums is sorted in nondecreasing order.

More Bloomberg LP Onsite Interview questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Merge Sorted ArrayDP World · ONSITE INTERVIEW
  • Merge Two Arrays Into Sorted OrderNVIDIA · ONSITE INTERVIEWNVIDIA interview questions
  • Two SumMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Merge Sorted ArrayAmazon · ONSITE INTERVIEW
  • Assign CookiesExpedia · PHONE SCREEN · ONSITE INTERVIEWExpedia interview questions
  • Combine Two Sorted Lists Into OneDocuSign · ONSITE INTERVIEWDocuSign interview questions
  • Count Winning Dice Face PairsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Merge Sorted Squares of Two ArraysWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
  • 3Sum SmallerSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Sort Ones, Twos, and Threes In PlaceAgoda · PHONE SCREEN · ONSITE INTERVIEWAgoda interview questions

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int[] sortedSquares(int[] nums) {
        // Write your code here.
    }

}
Checking account…