DSA problem
Inverted Right-Angled Triangle of Stars
Given an integer N, print an inverted right-angled triangle of * characters. The first row has N stars, the second row has N - 1 stars, and so on until the last row has a single star.
This is the mirror image of the standard right-angled triangle: instead of growing from 1 star up to N, you start with N stars and shrink down. The only change is the inner loop bound, which now runs from 1 to N - i + 1 for row i.
It is a small twist, but it trains you to see how changing a loop boundary reshapes the output - a habit that pays off in sliding-window and boundary-driven algorithms later.
Examples
Example 1
Input:
N = 5Output:
*****
****
***
**
*Explanation: Row 1 has 5 stars and each following row has one fewer, ending with a single star.
Constraints
- 1 <= N <= 100
3 hints and a full solution walkthrough with step-by-step visualizations are available in the practice editor.