FastPrepMedian Across N Sorted Arrays
Problems/Median Across N Sorted Arrays

Median Across N Sorted Arrays

Rippling logoRippling● HardINTERNNEW GRADFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Rippling phone screen. An intern report extends the median of two arrays to N sorted arrays. We chose how to treat empty rows and repeated values, the limits, and the target of searching by rank. Our version is about 90% the same as the reported question.

Given arrays, a collection of individually sorted integer arrays, return the median of every value across the collection. The rows may have different lengths or be empty, but at least one value exists overall.

Count every value, including duplicates. For an odd total number of values, return the middle value in the combined sorted order. For an even total, return the sum of the two middle values divided by two.

First describe a solution that combines all values and sorts them. Then use the sorted rows to find the middle positions without building a merged array.

Function

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

Examples

Example 1

arrays = [[1,7],[2,6],[3]]return = 3.0

The combined order is [1,2,3,6,7].

Example 2

arrays = [[1,4],[],[2,8]]return = 3.0

The two middle values are 2 and 4.

Example 3

arrays = [[-9,-3],[0],[2,2,8]]return = 1.0

The middle pair is 0 and 2.

Constraints

  • 1 <= arrays.length <= 2000.
  • The total number of values is between 1 and 10^5.
  • Every row is sorted in nondecreasing order.
  • Values are signed 32-bit integers.

More Rippling Phone Screen questions

  • Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
  • Delivery Cost Tracker with Effective-Dated RatesPHONE SCREEN · Seen Nov 2026
  • Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best and Worst Camel Card CompletionsPHONE SCREEN · Seen Nov 2026
  • Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • In-Memory Priority Task SchedulerPHONE SCREEN · Seen Oct 2026
  • Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Delivery Cost TrackerPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Split Array to Minimize the Largest SumNation with NaMo · PHONE SCREEN
  • Maximize Fish over Limited HoursByteDance · PHONE SCREEN
  • Median Across Sorted ArraysGoogle · PHONE SCREEN
  • Employee Ratings Management SystemAmazon · PHONE SCREEN
  • Running Medians and PercentilesStackAdapt · PHONE SCREEN
  • Median of Two Sorted ArraysGoldman Sachs · PHONE SCREEN
  • Dynamic First and Last Position in Sorted DataBloomberg LP · PHONE SCREEN
  • Minimize the Largest Part BeautyAdobe · PHONE SCREEN
  • First Element Greater Than KMeta · PHONE SCREEN
  • Koko Eating BananasThe D.E. Shaw Group · PHONE SCREEN
See Rippling hiring insights
Saved
class Solution {
    public double medianOfSortedArrays(int[][] arrays) {
        // Write your code here.
    }

}
Checking account…