Cant figure why one test case is not working


I have put 3 5 7 9 and I think the pattern is correct.

Hey @abhinavsehgal802_270a44594b6dc4ad,
Your code is printing extra columns for
n=7 (printing an extra first and last column, 9 columns in total) and
n=9 (printing 2 extra first and last columns, 13 columns in total, Also, various extra stars in the last line).

You had error in the calculation of initial nst;
nst should be initialised by (n+1)/2

Here is your updated code:

Hope it helps :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.