# Print Numbers by Recursion

Print numbers from 1 to the largest number with `n`

digits by recursion.

Itâ€™s pretty easy to do recursion like:

```
recursion(i) {
if i > largest number:
return
results.add(i)
recursion(i + 1)
}
```

However this cost a lot of recursion memory as the recursion depth maybe very large. Can you do it in another way to recursive with at most `n`

depth?

Example

Given `n = 1`

, return `[1, 2, 3, 4, 5, 6, 7, 8, 9]`

.

Given `n = 2`

, return `[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ..., 99]`

.