lc1563

By | August 23, 2020
Share the joy
  •  
  •  
  •  
  •  
  •  
  •  

dp[i][j] is the result between stone i, and stone j.

1563

If left is greater, then

dp[from][from+delta] = sum(i, from+delta) + dp[i][from+delta]

Else

right part

If both left and right are same, then choose the one which dp has larger value