FastPrepMerge Sorted Array
Problems/Merge Sorted Array

Merge Sorted Array

Bloomberg LP logoBloomberg LP● EasyNEW GRADFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a firsthand Bloomberg new-grad phone interview. In our version, you merge from the back of nums1.

nums1 has length m+n. Its first m values and all n values of nums2 are sorted nondecreasingly; the remaining positions of nums1 are capacity.

Merge both sorted sequences into nums1 and return it.

Function

mergeSortedArray(nums1: int[], m: int, nums2: int[], n: int) → int[]

Examples

Example 1

nums1 = [1,2,3,0,0,0]m = 3nums2 = [2,5,6]n = 3return = [1,2,2,3,5,6]

The two sorted prefixes merge in nondecreasing order.

Example 2

nums1 = [0]m = 0nums2 = [1]n = 1return = [1]

The first sequence is empty.

Constraints

  • 0 <= m, n and 1 <= m+n <= 10^5.
  • nums1.length == m+n and nums2.length == n.

More Bloomberg LP Phone Screen questions

  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Compact Conversation History by Token BudgetSierra · PHONE SCREENSierra interview questions
  • Remove Duplicates from Sorted ArrayNykaa · PHONE SCREENNykaa interview questions
  • Minimum Index Distance Between Person and CakeSnowflake · OA · PHONE SCREENSnowflake interview questions
  • Squares of a Sorted ArrayInstacart · PHONE SCREENInstacart interview questions
  • Closest Vehicle and Charger in a LineSpotify · PHONE SCREEN
  • Assign CookiesAmazon · PHONE SCREEN
  • Correct an In-Place Array ReversalDuolingo · PHONE SCREENDuolingo interview questions
  • Remove Duplicates From Sorted Array In PlaceKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Merge Two Sorted ArraysCapgemini · PHONE SCREENCapgemini interview questions
  • Remove Duplicates From Sorted Array In PlaceGet My Parking · PHONE SCREEN

Interview reports that mention this question

  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)

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 SWE Interviews: 167 Questions (Part 1 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int[] mergeSortedArray(int[] nums1, int m, int[] nums2, int n) {
      // Write your code here.
    }
}
Checking account…