Gold grid problem

Hey @soniyaman931
What is your doubt here ?

1 Like

incorrect output show ho rha h.

incorrect output the crct o/p is 3.

@soniyaman931
You forgot to initialise grid values to 0
Add this to line 10
memset(grid,0,sizeof(grid));
Line 34-37
Replace n with n-1
If your doubt is resolved please close it

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.