easy+150 XPFrontend AlgoArena
Array Flattening with Depth
Nested array structures are common in JSON APIs. Implement a custom array flattener flatten(arr, depth).
What it has to do
- Recursively flatten sub-arrays up to
depth. - Default depth should be 1 if not specified.
- Do not mutate original array.
Your workspace
Try it yourself· Edit the code, then press Run
Loading playground...
Ready to check it?
3 tests run against your code, right here in your browser. Sign in to claim the XP when you pass.
AI Crack & Solution Assist
Stuck? Get instant AI hints or break down the optimal solution.