The only difference is that if a cell is - 1 , simply ignore it else recursively compute count value maze [ i ] [ j ]
for i in range ( 1 , R ) : NEW_LINE INDENT for j in range ( 1 , C ) : NEW_LINE DEDENT