Right and down , both are valid moves
else dp [ i , j ] = grid [ i , j ] + Math . Max ( maxSumPath ( i , j + 1 , n , grid , dp ) , maxSumPath ( i + 1 , j , n , grid , dp ) ) ; } return dp [ i , j ] ; }