dynamic programming: contiguous subsequence of a max sum