FastPrepSliding Window Median
Problems/Sliding Window Median

Sliding Window Median

Notion logoNotion● HardFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A Notion onsite report names Sliding Window Median and confirms the full array and window setup in a follow-up. We use the standard definition that the report refers to.

Our version is about 100% the same as the reported question.

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 Notion interview questions

  • Nested Todo ListPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Top Error Types in a Time WindowONSITE INTERVIEW · Seen Jun 2026
  • DAG Downstream NodesONSITE INTERVIEW · Seen Apr 2026
  • Mutable Table AggregationsPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2026
  • Page Permission InheritancePHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2026
  • Text Document HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2026
  • Task Row ModificationsONSITE INTERVIEW · Seen Oct 2025
  • JSON Block Tree OperationsONSITE INTERVIEW · Seen Jul 2025
  • Block Type with the Most ChildrenPHONE SCREEN · Seen Mar 2026
  • Country with the Most EventsPHONE SCREEN · Seen Mar 2026

Similar questions at other companies

  • Sliding Window Median of Response TimesGoogle · ONSITE INTERVIEWGoogle interview questions
  • Sliding Window MedianBloomberg LP · ONSITE INTERVIEWBloomberg LP 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
  • 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
  • Longest Subarray with K Distinct ValuesAmazon · ONSITE INTERVIEW

Notion interview experiences

  • Notion Interviews, Level Not Reported: 20 Experiences
  • Notion Experienced SWE Interviews: 7 Experiences
  • Notion SWE New Grad Interviews: 3 Experiences
  • Notion SWE Intern Interviews and Debugging Round: 6 Experiences
  • Notion New Grad SWE Onsite Invitations: 2 Experiences
All Notion interview questionsSee Notion hiring insights
Saved
class Solution {
    public double[] medianSlidingWindow(int[] nums, int k) {
        // Write your code here.
    }

}
Checking account…