Update PeakElementFinder.java

This commit is contained in:
Imran Alam 2024-03-06 12:04:06 +05:30 committed by GitHub
parent dd251d2d33
commit c204c4c073
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -14,7 +14,7 @@ public class PeakElementFinder {
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
if (isPeak(arr, i, n)) { if (isPeak(arr, i, n)) {
peaks.add(i); peaks.add(arr[i]);
} }
while (i < n - 1 && arr[i] == arr[i + 1]) { while (i < n - 1 && arr[i] == arr[i + 1]) {