Doubt regarding initialization of nsp value

We could have initialized the value of nsp as n+2. Why 2n-3?

@saijaltripathy_e79096f8f1ec20e3 see for n = 8 total no. of spaces required for the exact pattern will be 15 bcoz no. of stars in last line is 2n-1 but n+2 will give only 10 spaces due to which pattern will not be appropriate.

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.

I could not get what you are saying. Please explain again.

@saijaltripathy_e79096f8f1ec20e3 check your pattern using n = 8 and you will see that no. of spaces required is 2n-3 not n - 2;

Ok, please wait for sometime so that I can check.

@pssharma1410 So, in such questions, we need to initialize the value of nsp according to the no. of total stars in the last line?

@saijaltripathy_e79096f8f1ec20e3 yes

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.

Okay, thank you very much!