Loading...

The Narrow Lens

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

Domain
Python
Difficulty
medium
Seniority
senior

Problem

Our real-time metrics dashboard smooths noisy signal data using a sliding window. Build a class that maintains the last N values added and returns the current window average each time a new value arrives. If fewer than N values have been added, average what's present.

Practice This Problem

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