DataDriven
LearnPracticeInterviewDiscussDailyJobs

The Middle Ground

A hard Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
hard
Seniority
L5

Problem

Implement RunningMedian that supports add(x) and get_median(). get_median returns the current median of all values added so far (average of the two middle values for even counts). Test harness passes ['add', x] and ['get_median'] ops and expects parallel results: None for add, the median for get_median.

Summary

The middle value keeps moving.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.

Related

  • All Practice Problems
  • Mock Interview Mode
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Daily Challenge
  • Data Engineering Lessons