Facebook Pixel

Why does the bottom half start at N-1?

To prevent the thickest middle row (where there are zero spaces) from being printed twice.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in The Butterfly Star Pattern (Combining Triangles)

It requires coordinating three separate inner loops (left stars, middle spaces, right stars) per row, and mirroring the entire structure for the bottom half.

The total width is 2N. The stars take up 2 * row. Therefore, the formula for the remaining middle space is 2 * (N - row).

You copy the exact three inner loops from the top half, but place them inside an outer loop that iterates backwards from N-1 down to 1.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.