What are the boundaries for a hollow pyramid?
Inside the star loop, the boundaries are the first column (col == 1), the last column (col == 2*row - 1), and the final row (row == N).
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Advanced Hollow Patterns (Hollow Pyramid)
First, use an inner loop to print the required leading spaces to align the shape. Then, use a second inner loop with if-else boundary checks to draw the hollow interior.
Because once the leading spaces have aligned the shape, the hollow center of the pyramid must be filled with blank spaces to push the right-side stars to their correct positions.
Yes, you can use pure coordinate logic on a full rectangular grid, but calculating the diagonal boundaries mathematically is often much harder than the multi-loop approach.
Still have questions?
Browse all our FAQs or reach out to our support team
