how to decide when to turn 5*5 grid from -1 to 0
How to approach this?/
hey @chemant077,since getting score 0 is much better than -1 so you can always change it in the beginning of your traversal.
cant able to understand how to initiate it please help me
hey @chemant077 take a recursive function and start it with your position (n,2) for every position it can move in three points call this three points recursively{(row-1,col-1)(row-1,col)(row-1,col+1)} untill you get to the first row and add sum of values of grid and return it to the function.
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.
how to check whether the current index is with in first 5*5 range out of the matrix
@chemant077 you can change any consecutive 5 rows not only the first five rows.i have updated your code a little refer to this for help (https://ide.codingblocks.com/s/181708)
for what you have taken k for ??
k is used here to make a grid of 5*5.