An algorithm to determine subsequence with maximum sum.