Back
Close
  • 172

Learning Opportunities

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

Statement

 Goal

You are given a number, N, of glasses. Your job is to determine the largest pyramid that can be built with the glasses provided, and then create that pyramid in the output.

A glass is represented in ASCII as follows:


 ***    
* *
* *
*****
Input
A single integer: N, indicating the number of glasses.
Output
The ASCII pyramid

Example for N between 6 and 9:


       ***       
* *
* *
*****
*** ***
* * * *
* * * *
***** *****
*** *** ***
* * * * * *
* * * * * *
***** ***** *****
Constraints
0<N<30
Example
Input
4
Output
    ***    
    * *    
    * *    
   *****   
 ***   *** 
 * *   * * 
 * *   * * 
***** *****

A higher resolution is required to access the IDE