akshitagit / JavaScript

Repository for JavaScript codes and algos.Star the repo too.
https://github.com/akshitagupta15june
MIT License
86 stars 112 forks source link

Hour glass Pattern #4

Closed akshitagupta15june closed 4 years ago

akshitagupta15june commented 4 years ago

Take N as input. For a value of N=5, we wish to draw the following pattern :

                  5 4 3 2 1 0 1 2 3 4 5
                    4 3 2 1 0 1 2 3 4 
                      3 2 1 0 1 2 3 
                        2 1 0 1 2 
                          1 0 1 
                            0 
                          1 0 1 
                        2 1 0 1 2 
                      3 2 1 0 1 2 3 
                    4 3 2 1 0 1 2 3 4 
                  5 4 3 2 1 0 1 2 3 4 5

Input Format

Take N as input. Constraints

N <= 20 Output Format

Pattern should be printed with a space between every two values. Sample Input

5

akshitagupta15june commented 4 years ago

Add in patterns repo of javascript.

MLpranav commented 4 years ago

Pull request #8