I have tried this problem many times now but I can’t get it right. Please share the solution to this problem.
Pattern InvertedHourGlass
In the given pattern,
- First build an intuition that u need to work for first row and at the end of the loop need to do work for the next row.
- For each row first you need to print your pattern in decreasing order then spaces and then the same pattern but in increasing order.
- To build the whole pattern just repeat this work according to total number of rows. With this approach, things seems to work out easily.
Code:
if this solves your doubt please mark it as resolved