I cant make algorithm for this question

please suggest some refrence or anthing else

hi @dheerajjha11111_bb855e8d7a52ef0d,
Pattern Hack : Always first Try to first print pattern by ignoring the value to be printed then accommodate your value in that pattern. For e.g.,

                      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

View it as:-

                      * * * * * * * * * * *
                        * * * * * * * * * 
                          * * * * * * * 
                            * * * * * 
                              * * * 
                                * 
                              * * * 
                            * * * * * 
                          * * * * * * * 
                        * * * * * * * * * 
                      * * * * * * * * * * *

Short Info about the variables:-

1. nsp (number of spaces)-> Number of spaces in very First Line of the pattern.
2. nst (number of stars)-> Number of stars in very first line of the pattern.
3. csp (counter of spaces)-> counter of spaces that will print the required number of spaces and will be initialized with 1 and incremented upto nsp.
4. cst (counter of stars)->  counter of spaces that will print the required number of stars and will be initialized with 1 and incremented upto nst.
5. rows -> It will be initialized with 1 and will go upto the total number of rows in the pattern.

Given pattern is seen as first spaces and then numbers.The numbers are first in in decreasing order and then in increasing order in a row. Spaces first increases and then decreases in a row. So do the work of spaces first and then that of numbers.And then change variables accordingly for next iterations.

refer this -->

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.