The Rolling Window
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
Given a list of numbers and positive integer k, compute the average of every contiguous window of size k. Return the list of averages (one per window) rounded to 2 decimals. If len(nums) < k, return an empty list.
Summary
Smooth things out, one step at a time.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.