diff --git a/core-java-modules/core-java-collections-array-list-2/src/main/java/com/baeldung/peakelements/PeakElementFinder.java b/core-java-modules/core-java-collections-array-list-2/src/main/java/com/baeldung/peakelements/PeakElementFinder.java index c26871655c..857ae3b1b2 100644 --- a/core-java-modules/core-java-collections-array-list-2/src/main/java/com/baeldung/peakelements/PeakElementFinder.java +++ b/core-java-modules/core-java-collections-array-list-2/src/main/java/com/baeldung/peakelements/PeakElementFinder.java @@ -14,7 +14,7 @@ public class PeakElementFinder { for (int i = 0; i < n; i++) { if (isPeak(arr, i, n)) { - peaks.add(i); + peaks.add(arr[i]); } while (i < n - 1 && arr[i] == arr[i + 1]) {