My code is outputting extra 0s


can you find where the extra 0s are coming from and correct my code

wait leave, it’s working now

another problem im facing is that it is only able to pass 2 of the three test cases can you help me with what is wrong?

here’s the new link https://ide.codingblocks.com/s/617891

Hi Arya,
I have made changes… refer this https://ide.codingblocks.com/s/617892

this code uses push and pull operations and vectors, i haven’t been taught those in the tutorials
can i not solve this question using basic array function?
please help changing my code errors if that is possible.

ya sure… will just change vector to array

okay sure thankyou
also pushback functions and pull, haven’t been taught

hi Arya… this u would get to learn in vectors… basically vectors and arrays are very much similar only… for arrays based approach u can refer this https://www.geeksforgeeks.org/print-matrix-diagonal-pattern/

Hi… I hope ur doubt is cleared now??

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.