From charlesreid1

(Created page with "==Problem Description== Given a sequence of integers, <math>a_1, a_2, \dots, a_n</math>, determine the subsequence of integers with the maximum sum. (Note, this problem is...")
 
m (Replacing charlesreid1.com:3000 with git.charlesreid1.com)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
MVCS: Maximum value contiguous subsequence
==Problem Description==
==Problem Description==


Line 7: Line 9:
==Solution==
==Solution==


https://charlesreid1.com:3000/cs/java/src/master/dynamic-programming/max-val-seq
This is a fairly straightforward dynamic programming problem that just requires evaluating the maximum sum for a sliding window, and store the results in a 1D array.
 
https://git.charlesreid1.com/cs/java/src/master/dynamic-programming/max-val-seq


==Flags==
==Flags==

Latest revision as of 03:38, 9 October 2019

MVCS: Maximum value contiguous subsequence

Problem Description

Given a sequence of integers, $ a_1, a_2, \dots, a_n $, determine the subsequence of integers with the maximum sum.

(Note, this problem is only interesting if there are negative numbers.)

Solution

This is a fairly straightforward dynamic programming problem that just requires evaluating the maximum sum for a sliding window, and store the results in a 1D array.

https://git.charlesreid1.com/cs/java/src/master/dynamic-programming/max-val-seq

Flags