Rat in a maze-doubt

code:https://ide.codingblocks.com/s/120499
getting wrong answer in 4th test case?

@dvitiarora Just initialize line 41–> int out[1000][1000]={0} and then check.

Hope this helps :slightly_smiling_face:

@pratyush63 why do we have to do this ?

@dvitiarora You must initialize the output matrix before with 0 else some of the matrix positions may hold some garbage values. If the integer matrix was declared global or static then by default it would hold 0 but in this case it is neither global nor static so initializing is mandatory.