
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Write a recursive function that keeps track of the current depth.
if the current depth >= the maximum depth, always just push the value to the returned array. Otherwise recursively call flat on the array.