Right and down , both are valid moves
else : NEW_LINE INDENT dp [ i ] [ j ] = totalPaths ( i , j + 1 , n , grid , dp ) + totalPaths ( i + 1 , j , n , grid , dp ) NEW_LINE DEDENT return dp [ i ] [ j ] NEW_LINE