Game Theory problems are classified as DP problems.
And this is a classic one. Because there are two players gaming and so many possible moves,
that comes with a huge searching space with a lot of overlaps.
So overlaps must be eliminated by Memoization.
And let's see the 4 Elements of the DP:
1. initialization: (or termination)
dp[i][i] = 0;
2. transfer formula:
dp[i][j] = sum[i][j] + (for all the possible k) min(dp(i, k) + dp(k, j));
3. Result:
dp(0, length - 1);
No comments:
Post a Comment