Back
Close
  • 268

Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

Statement

 Goal

You will be given an integer N, your goal is to draw the highest truncated pyramid that contains N “bricks”.
Each floor of a pyramid contains one brick more than the previous one.
Each brick is a * and each floor begins at the left of the line.
Be careful not to add spaces at the end of a line.
Input
Line 1: An integer N, the number of bricks you have
Output
The truncated pyramid
Constraints
1 ≤ N ≤ 100
Example
Input
1
Output
*

A higher resolution is required to access the IDE