FastPrepMedian Across Sorted Arrays
Problems/Median Across Sorted Arrays

Median Across Sorted Arrays

Google logoGoogle● HardFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Our version is about 90% the same as the reported question. The interview report names the well-known median of two sorted arrays task and a follow-up that extends it to many sorted sequences. We chose the matrix wrapper and the number we return when the length is even.

You are given an array of individually sorted integer arrays. Return the median of all values across every input array without changing their order.

Empty inner arrays are allowed, but at least one value exists overall. For an even total number of values, return the sum of the two middle values divided by two.

Function

medianOfSortedArrays(arrays: int[][]) → double

Examples

Example 1

arrays = [[1,3],[2]]return = 2.0

The merged order is [1,2,3], whose middle value is two.

Example 2

arrays = [[1,2],[3,4],[]]return = 2.5

The two middle values are two and three.

Example 3

arrays = [[-5,-1,7],[0,2,9],[3,4]]return = 2.5

Across eight values, the middle pair is two and three.

Constraints

  • 1 <= arrays.length <= 100000
  • Every inner array is sorted in nondecreasing order.
  • The total number of values is between 1 and 200000.
  • Values are signed 32-bit integers.

More Google Phone Screen questions

  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Logger Rate Limiter with Every-Arrival HistoryPHONE SCREEN · Seen Nov 2026

Similar questions at other companies

  • Maximize Fish over Limited HoursByteDance · PHONE SCREENByteDance interview questions
  • Find the Safest Path in a GridAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • IPOTekion · PHONE SCREENTekion interview questions
  • Smallest Range Covering Elements from K ListsSnap Inc. · PHONE SCREENSnap Inc. interview questions
  • Running Medians and PercentilesStackAdapt · PHONE SCREENStackAdapt interview questions
  • IPOInMobi · PHONE SCREENInMobi interview questions
  • Meeting Rooms IIIBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Running Median of a StreamPeopleStrong · PHONE SCREEN · ONSITE INTERVIEWPeopleStrong interview questions
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public double medianOfSortedArrays(int[][] arrays) {
        // Write your code here.
    }

}
Checking account…