Please explain why my code is not compiling

I don’t want the solution. I know my code will not output brackets at the start and at the end as required in the question. Please tell me why this code is not compiling. I was trying a similar approach in another question and I got a compilation error.

hi @jainutkarsh0211
I have corrected ur code… its working fine now…

In my course vector has not been covered yet and you have used it in your solution. Can you please explain why I am getting compilation errors in my original solution? I tried to find it myself and gave it 3-4 hours to it but I couldn’t do so. I want to know my mistake so that I do not repeat it again. It would be really a great help if you will explain my mistake. So please please please tell me my mistake.

I have used vector just to print the o/p in the desired format… rest error in ur code was due to incorrect array access… also u were not checking if index was going out of bounds while checking number at i+1 th position… just go through my code, and leave the vector part… u will get better insight…

1 Like

I have made some changes but still, I am getting errors.

hi @jainutkarsh0211
kindly go through the code I sent above… I hope all ur doubts will be resolved…

1 Like

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.