Flatten Nested List

Medium
recursion Meta Google

Write a recursive function that flattens an arbitrarily nested list of integers into a single flat list.

Example

flatten([1, [2, [3, 4], 5], [6, 7]])
# => [1, 2, 3, 4, 5, 6, 7]

Test Cases

Python Editor

Output

Click "Run" to see results...