Row Number Triangle

Given a positive integer n, return a left-aligned number triangle with n rows. Row i contains the digit i repeated exactly i times, with no spaces between…

Given a positive integer n, return a left-aligned number triangle with n rows. Row i contains the digit i repeated exactly i times, with no spaces between digits. Join adjacent rows with one newline character and do not add spaces or a trailing newline.

- 1 ≤ n ≤ 9 - n is always a positive integer. - The upper bound keeps every repeated value to one digit.

Example 1: input n = 5; output 1 22 333 4444 55555. Row i uses i as both the repeated digit and the number of repetitions.

Example 2: input n = 1; output 1. The smallest triangle contains the single digit 1.

Category: Pattern Programs. Topic: pattern-programs. Difficulty: Easy. Patterns: math.