My Blog List

[Leetcode Solution] Maximum Subarray

Analysis 

  • Dynamic Programming problem
  • Let f[i] denote the the maximum subarray value of the substring ending at i-th element,
  • f[i] = f[i-1]>0 ? f[i-1]+A[i] : A[i]
  • Like breadth first search state compress can  be used because only the most previous one result is used

Note

Code


No comments:

Post a Comment

Enter you comment