We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c1c583 commit cb4530bCopy full SHA for cb4530b
Other/MaxSubseqDifferenceNoOverlap.java
@@ -10,10 +10,14 @@ public static void main(String[] args) {
10
}
11
12
/**
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
18
*/
19
public int MaxSubseqDifferenceNoOverlap(int[] A) {
- int[] finalMax = null;
20
+ int[] finalMax = null; // subsequences
21
int[] finalMin = null;
22
Integer maxDiff = null; // use Integer to determine whether it's set
23
for (int i = 0; i < A.length; i++) {
0 commit comments