Print N to 1
Given a positive integer n, return the integers from n down to 1 as one space-separated string. Include both n and 1 in the descending order.
Given a positive integer `n`, return the integers from `n` down to `1` as one space-separated string. Include both `n` and `1` in the descending order.
- `1 <= n <= 20` - Return exactly one space between adjacent integers, with no leading or trailing spaces.
Example 1: input n = 4; output "4 3 2 1". Record the current value before recursively continuing with the next smaller value.
Example 2: input n = 1; output "1". The base value is the complete sequence.
Category: Math & Numbers. Topic: math. Difficulty: Easy. Patterns: recursion.