PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Meta

Compute sliding-window medians

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in designing and analyzing efficient sliding-window algorithms and data structures for computing running medians, including correct handling of duplicates, deletions, and the convention for defining the median when k is even.

  • Medium
  • Meta
  • Coding & Algorithms
  • Machine Learning Engineer

Compute sliding-window medians

Company: Meta

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Given an array nums and an integer k, compute the median for each contiguous subarray (window) of length k and return the sequence of medians in order. Describe an algorithm running in O(n log k) time that handles duplicates and deletions efficiently, specify how to define the median when k is even, and analyze space complexity.

Quick Answer: This question evaluates proficiency in designing and analyzing efficient sliding-window algorithms and data structures for computing running medians, including correct handling of duplicates, deletions, and the convention for defining the median when k is even.

Related Interview Questions

  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve a Key-Door Corridor Maze - Meta (medium)
  • Solve Array Merge and Parentheses Cleanup - Meta (medium)
  • Solve Two Backtracking Array Problems - Meta (hard)
  • Solve Maze and Suffix Problems - Meta (medium)
Meta logo
Meta
Jul 31, 2025, 12:00 AM
Machine Learning Engineer
Technical Screen
Coding & Algorithms
1
0

Given an array nums and an integer k, compute the median for each contiguous subarray (window) of length k and return the sequence of medians in order. Describe an algorithm running in O(n log k) time that handles duplicates and deletions efficiently, specify how to define the median when k is even, and analyze space complexity.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Meta•More Machine Learning Engineer•Meta Machine Learning Engineer•Meta Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.