Left Star Triangle
Given a positive integer n, return a left-aligned triangle with n rows. Row i contains exactly i stars. Do not add spaces between stars or trailing spaces to…
Given a positive integer n, return a left-aligned triangle with n rows. Row i contains exactly i stars. Do not add spaces between stars or trailing spaces to a row. Join adjacent rows with one newline character and do not add a trailing newline.
- 1 ≤ n ≤ 10 - n is always a positive integer. - The output contains exactly n rows.
Example 1: input n = 4; output * ** *** ****. Each row adds one star, growing from one star to four.
Example 2: input n = 1; output *. The smallest triangle is one row containing one star.
Category: Pattern Programs. Topic: pattern-programs. Difficulty: Easy. Patterns: math.