PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Tinder

Design a data structure to find streaming median

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in data structure and streaming algorithm design for maintaining the median of a dynamic integer stream, testing competency in algorithmic thinking and analysis of time- and space-complexity within the Coding & Algorithms domain; the level of abstraction is practical application with implementation and performance considerations. It is commonly asked to assess the ability to design efficient, scalable online aggregation methods for large or repetitive inputs and to reason about memory and run-time trade-offs, with the follow-up focusing on optimizing for extremely large streams with many duplicates.

  • medium
  • Tinder
  • Coding & Algorithms
  • Software Engineer

Design a data structure to find streaming median

Company: Tinder

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

### Problem Design a data structure that supports maintaining the **median** of a stream of integers. Implement a class/ADT with the following operations: - `addNum(x)`: Add an integer `x` to the data structure. - `findMedian()`: Return the median of all numbers added so far. ### Median definition - If the count `n` is odd, the median is the middle element after sorting. - If `n` is even, the median is the average of the two middle elements (return a floating-point number if needed). ### Constraints / expectations - The stream can be very large. - Values may include negatives and duplicates. - Aim for efficient per-operation time (better than sorting on every query). ### Follow-up If the input stream is **extremely large** and contains **many repeated values**, how would you optimize the design (time and/or memory)?

Quick Answer: This question evaluates proficiency in data structure and streaming algorithm design for maintaining the median of a dynamic integer stream, testing competency in algorithmic thinking and analysis of time- and space-complexity within the Coding & Algorithms domain; the level of abstraction is practical application with implementation and performance considerations. It is commonly asked to assess the ability to design efficient, scalable online aggregation methods for large or repetitive inputs and to reason about memory and run-time trade-offs, with the follow-up focusing on optimizing for extremely large streams with many duplicates.

Tinder logo
Tinder
Feb 9, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
3
0
Loading...

Problem

Design a data structure that supports maintaining the median of a stream of integers.

Implement a class/ADT with the following operations:

  • addNum(x) : Add an integer x to the data structure.
  • findMedian() : Return the median of all numbers added so far.

Median definition

  • If the count n is odd, the median is the middle element after sorting.
  • If n is even, the median is the average of the two middle elements (return a floating-point number if needed).

Constraints / expectations

  • The stream can be very large.
  • Values may include negatives and duplicates.
  • Aim for efficient per-operation time (better than sorting on every query).

Follow-up

If the input stream is extremely large and contains many repeated values, how would you optimize the design (time and/or memory)?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Tinder•More Software Engineer•Tinder Software Engineer•Tinder Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ 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.