![]() |
VOOZH | about |
Given a number n, write a program to print a diamond shape with 2n-1 rows.
Examples :
Input: 5
Output:
* * * * * * * * * * * * * * * * * * * * * * * * *
Time Complexity: O(n*n) since we are traversing rows and columns of a grid for printing spaces ' ' and star '*'.
Auxiliary Space: O(1), No extra space used.