#解决什么问题?

Maximum subarray sum

#思想

dp[i] represents the maximum subarray sum ending with i-th element

dp[i] = Math.max(dp[i - 1] + A[i], A[i])

#应用

  • LeetCode 53 Maximum Subarray
  • LeetCode 918 Maximum Sum Circular Array

Comments