993. Print 1 to N using Recursion
Given an integer n, write a function to print all numbers from 1 to n (inclusive) using recursion.
- You must not use any loops such as for, while, or do-while.
- The function should print each number on a separate line, in increasing order from 1 to n.
Example 1:
Input: n = 5
Output:
1Â Â
2Â Â
3Â Â
4Â Â
5
Example 2:
Input: n = 1
Output:
1
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= n <= 100