Last Updated: 22 Aug, 2025

Inverted Left Half Pyramid

Easy
Asked in company
Amdocs

Problem statement

You are given an integer 'n'.

Your task is to print a pattern of stars (*) and spaces () that forms an inverted, left-aligned pyramid of height 'n'.

The pattern should follow these rules:

1) The first (top) row must contain 'n' stars and 0 leading spaces.
2) Each subsequent row must contain one more leading space and one fewer star than the row above it.
3) The last (bottom) row must contain 'n-1' leading spaces and 1 star.


Input Format:
The first line of input contains a single integer 'n'.


Output Format:
Print 'n' lines, each containing the appropriate number of leading spaces and stars to form the pyramid.

Do not print any trailing spaces after the stars on any line.


Note:
The total number of characters (spaces + stars) on each line will always be 'n'.