FastPrepMedian of Two Sorted Arrays
Problems/Median of Two Sorted Arrays

Median of Two Sorted Arrays

Bloomberg LP logoBloomberg LP● HardNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Bloomberg new-grad reports name this exact well-known problem. Our version is about 100% the same as the reported question.

Given two sorted integer arrays nums1 and nums2, return the median of the two arrays as if they were merged.

Your algorithm must run in O(log(min(nums1.length, nums2.length))) time.

Function

findMedianSortedArrays(nums1: int[], nums2: int[]) → double

Examples

Example 1

nums1 = [1,3]nums2 = [2]return = 2.0

Merging the two arrays gives [1,2,3], and its middle value is 2.

Example 2

nums1 = [1,2]nums2 = [3,4]return = 2.5

The middle values are 2 and 3, so the median is their average.

Constraints

  • 0 <= nums1.length, nums2.length <= 10^5.
  • 1 <= nums1.length + nums2.length <= 2 * 10^5.
  • -10^9 <= nums1[i], nums2[i] <= 10^9.
  • Both arrays are 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

  • Shortest Subarray with Sum at Least KOracle · ONSITE INTERVIEWOracle interview questions
  • Russian Doll EnvelopesGoogle · ONSITE INTERVIEWGoogle interview questions
  • K-th Element of Two Sorted ArraysFlipkart · ONSITE INTERVIEW
  • Allocate Minimum PagesAmazon · ONSITE INTERVIEW
  • Minimum Processing Speed with Multiple RidersDoorDash · ONSITE INTERVIEWDoorDash interview questions
  • Russian Doll EnvelopesInMobi · ONSITE INTERVIEWInMobi interview questions
  • Median of Two Sorted ArraysRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Median of Two Sorted ArraysMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Russian Doll EnvelopesAirbnb · ONSITE INTERVIEWAirbnb interview questions
  • Median of Two Sorted ArraysExpedia · ONSITE INTERVIEWExpedia interview questions

Interview reports that mention this question

  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 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 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 double findMedianSortedArrays(int[] nums1, int[] nums2) {
      // Write your code here.
    }
}
Checking account…