Merge branch 'eugenp:master' into master

This commit is contained in:
Ulisses Lima 2022-06-03 10:03:45 -03:00 committed by GitHub
commit 681aeb3142
215 changed files with 1022 additions and 92 deletions

View File

@ -14,7 +14,7 @@ public class KadaneAlgorithm {
int end = 0; int end = 0;
int maxSoFar = arr[0], maxEndingHere = arr[0]; int maxSoFar = arr[0], maxEndingHere = arr[0];
for (int i = 0; i < size; i++) { for (int i = 1; i < size; i++) {
if (arr[i] > maxEndingHere + arr[i]) { if (arr[i] > maxEndingHere + arr[i]) {
start = i; start = i;

View File

@ -27,4 +27,16 @@ class KadaneAlgorithmUnitTest {
//then //then
assertEquals(-1, maxSum); assertEquals(-1, maxSum);
} }
@Test
void givenArrayWithAllPosiitveNumbersWhenMaximumSubarrayThenReturnsExpectedResult() {
//given
int[] arr = new int[] {4, 1, 3, 2};
//when
KadaneAlgorithm algorithm = new KadaneAlgorithm();
int maxSum = algorithm.maxSubArraySum(arr);
//then
assertEquals(10, maxSum);
}
} }

View File

@ -8,7 +8,7 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>apache-cxf</artifactId> <artifactId>apache-cxf-modules</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>

View File

@ -8,7 +8,7 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>apache-cxf</artifactId> <artifactId>apache-cxf-modules</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>

View File

@ -8,7 +8,7 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>apache-cxf</artifactId> <artifactId>apache-cxf-modules</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>

View File

@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>apache-cxf</artifactId> <artifactId>apache-cxf-modules</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>apache-cxf</artifactId> <artifactId>apache-cxf-modules</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>apache-cxf</name> <name>apache-cxf</name>
<packaging>pom</packaging> <packaging>pom</packaging>

View File

@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>apache-cxf</artifactId> <artifactId>apache-cxf-modules</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>

View File

@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId> <artifactId>core-groovy-modules</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
</parent> </parent>

View File

@ -10,7 +10,7 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId> <artifactId>core-groovy-modules</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
</parent> </parent>

View File

@ -10,7 +10,7 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId> <artifactId>core-groovy-modules</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
</parent> </parent>

Some files were not shown because too many files have changed in this diff Show More