diff --git a/core-java-modules/core-java-arrays-operations-advanced-2/src/main/java/com/baeldung/equilibriumindex/EquilibriumIndexFinder.java b/core-java-modules/core-java-arrays-operations-advanced-2/src/main/java/com/baeldung/equilibriumindex/EquilibriumIndexFinder.java new file mode 100644 index 0000000000..dfb9e8ee10 --- /dev/null +++ b/core-java-modules/core-java-arrays-operations-advanced-2/src/main/java/com/baeldung/equilibriumindex/EquilibriumIndexFinder.java @@ -0,0 +1,24 @@ +package com.baeldung.equilibriumindex; + +import java.util.ArrayList; +import java.util.List; + +class EquilibriumIndexFinder { + + List findEquilibriumIndexes(int[] array) { + int[] partialSums = new int[array.length + 1]; + partialSums[0] = 0; + for (int i=0; i equilibriumIndexes = new ArrayList(); + for (int i=0; i