O(n) AC JavaCode

Subproblem: t[i] is the maximum sum when the subsequence ends at ith element

Recurrence: t[i] = max(A[i],A[i]+t[i-1])
if A[i] is larger, it means the last sequence ends and an new one starts
if A[i]+t[i-1 is larger, it means the last sequence increases
Base Cases: t[0] = 0 which means sum of no element is 0