Loading...

Flatten the Feed

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

Domain
Python
Difficulty
easy
Seniority
junior, mid

Problem

The event feed API returns data nested to unpredictable depths, and the downstream consumer expects a flat array. Write a function that takes a nested list of any depth and produces a single flat list with all leaf elements 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.