Skip to content

Commit cb4530b

Browse files
committed
Updated MaxSubseqDiffNoOverlap
1 parent 9c1c583 commit cb4530b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Other/MaxSubseqDifferenceNoOverlap.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ public static void main(String[] args) {
1010
}
1111

1212
/**
13-
*
13+
* Cut input array in two halves
14+
* Find max contiguous subsequences sum in left half, min sum in right half
15+
* Find max contiguous subsequences sum in right half, min sum in left half
16+
* Get the two differences, the bigger one can be max difference
17+
* Update maxDiff and range with that
1418
*/
1519
public int MaxSubseqDifferenceNoOverlap(int[] A) {
16-
int[] finalMax = null;
20+
int[] finalMax = null; // subsequences
1721
int[] finalMin = null;
1822
Integer maxDiff = null; // use Integer to determine whether it's set
1923
for (int i = 0; i < A.length; i++) {

0 commit comments

Comments
 (0)