FastPrepSliding Window Median
Problems/Sliding Window Median

Sliding Window Median

Bloomberg LP logoBloomberg LP● HardNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report records Sliding Window Median as the follow-up to Sliding Window Maximum in a Bloomberg new-grad onsite. We use the usual meaning of the median of each window. For an even window, the answer is the average of the two middle values, as a decimal number.

Given an integer array nums and a window size k, return the median of every contiguous window of length k, from left to right.

For an odd-length window, the median is its middle sorted value. For an even-length window, it is the average of the two middle sorted values.

Function

medianSlidingWindow(nums: int[], k: int) → double[]

Examples

Example 1

nums = [1,3,-1,-3,5,3,6,7]k = 3return = [1.0,-1.0,-1.0,3.0,5.0,6.0]

Sorting each length-three window exposes its middle value.

Example 2

nums = [1,2]k = 1return = [1.0,2.0]

Each one-element window has that element as its median.

Example 3

nums = [1,4,2,3]k = 4return = [2.5]

The two middle sorted values are 2 and 3.

Constraints

  • 1 <= nums.length <= 50000
  • -1000000000 <= nums[i] <= 1000000000
  • 1 <= k <= nums.length

More Bloomberg LP Onsite Interview questions

  • 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
  • Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Sliding Window Median of Response TimesGoogle · ONSITE INTERVIEWGoogle interview questions
  • Sliding Window MedianNotion · ONSITE INTERVIEWNotion interview questions
  • Smallest Range Covering Elements from K ListsSnap Inc. · PHONE SCREENSnap Inc. interview questions
  • Auction Sniping Window MinimumCisco · OACisco interview questions
  • 15-Minute Chat Session TrackerOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Top K Frequent ElementsAmazon · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Shortest Window with Required CountsOracle · ONSITE INTERVIEWOracle interview questions
  • Count Zero Request ServersSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Top K Frequent ElementsCapgemini · ONSITE INTERVIEWCapgemini 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 double[] medianSlidingWindow(int[] nums, int k) {
        // Write your code here.
    }

}
Checking account…