Loading...

The Slow Leak

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

Domain
Python
Difficulty
medium
Seniority
junior, mid

Problem

Our ingestion layer receives data from multiple upstream sources, each wrapped in its own iterator. Some sources nest iterators inside iterators. Write a function called flatten_iter that takes an iterator which may yield either values or other iterators, and returns a single flat list of all leaf values in order.

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.