![]() |
VOOZH | about |
Here, we will build a C++ program to print the hollow star pyramid diamond shape pattern that can be achieved with two approaches i.e.
Input:
n = 5
Output:
* * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * *
Time complexity: O(n2) for given input n
Auxiliary Space: O(1)
* * * * * * * * * * * * * * * *
Time complexity: O(rows*columns)
Auxiliary Space: O(1)