first thought
- The same as Matrix chain multiplication, the maximum value from i to j is equal to the max of it’s sub cases.
- choose i ,choose i+1 to j-1, choose j
- choose i ,choose i+1 to j
- choose i to j-1, choose j
solution
|
|
problem
WA.
reason
It’s not the same as matrix ,because in the matrix we multiplicate one number each time, but in this problem, different split can influence the combination result as we can choose not only one number each time.
modification
The DFS answer
|
|
another solution
- According to the DFS solution, here’s the DP solution.
|
|