Deep Flatten
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 that may contain other lists nested to arbitrary depth, return a single flat list of all leaf values in left-to-right order. Non-list values are leaves; strings are leaves (do not iterate into them).
Summary
Nested deep. Flatten everything.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.