Premium

Flatten with Depth

By FrontendAtlas Team · Updated Jan 31, 2026

Implement flatten(arr, depth) that flattens nested arrays up to a specific depth. Depth controls how many nesting levels to remove: depth = 0 returns a shallow copy; depth = 1 flattens one level. Handle mixed primitives and arrays.

Challenge preview

Flatten with Depth: Implement flatten(arr, depth) that flattens nested arrays up to a specific depth. Depth controls how many nesting levels to remove: depth = 0 returns…. Expect arrays and depth decisions under intermediate level constraints.

Premium unlocks

  • Full editor workflow with starter files, tests, and solution context.
  • Edge cases, common mistakes, and complexity notes for the interview discussion.
  • Progress tracking once you unlock and complete the challenge.

Free warm-up options

Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.