DSA problem
Right-Angled Triangle of Stars
Given an integer N, print a right-angled triangle made of * characters. The triangle has N rows, and row i contains exactly i stars.
This is the classic "Hello World" of pattern problems. You use two nested loops: the outer loop controls the row number (from 1 to N), and the inner loop prints stars equal to the current row number. After each row you emit a newline to move down.
Mastering this pattern teaches you how nested loops interact and how to reason in terms of rows and columns - a skill you will reuse constantly in matrix and grid problems.
Examples
Example 1
Input:
N = 5Output:
*
**
***
****
*****Explanation: Row 1 has 1 star, row 2 has 2 stars, and so on until row 5 has 5 stars.
Constraints
- 1 <= N <= 100
3 hints and a full solution walkthrough with step-by-step visualizations are available in the practice editor.