Problem 148371 · easy · Level 01 Prerequisites & Setup

Countdown Rows

nested loops · strings · range

Given n, return n strings. Row i (1-based) counts down from i to 1, with the numbers separated by single spaces.

Examples

Input:  n = 3
Output: ["1", "2 1", "3 2 1"]

Input:  n = 1
Output: ["1"]

Constraints

  • 0 <= n <= 60
  • Return [] when n is 0.

Goals

  • Use a decreasing range inside an outer loop
  • Join numbers into a single space-separated string
Starting Python…