@jasonshieh
i dont understand dp[i-1][j-1], neither.

is this supposed to be

max(
dp[i-1][j-1] + grid[i][len-i] + grid[j][len-j]
dp[i-1][j] + grid[i][len-i]
dp[i][j-1] + grid[j][len-j]
dp[i][j])
if the dp[i-1][j-1] is the previous status?
we add two new grid value for dp[i-1][j-1] (move i, move j)
but the original code, get the max, and add two steps?

@zitman
I think this can be solved with the greedy method + a divide and conquer.
There will be two cases: 1) two routes does not visit the same node ( on the dialog); 2) two routes visit a same node.

In the first case, it can be solved with the greedy DP algorithm.

In the second case, it can be divided into two sub-problems and can be solved with divide and conquer.

So we just need to compare these two cases and get the max.