Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Peaks.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public int solution(int[] A) {
}

// 2) check the number of Blocks
int N = A.length;
// Max number of blocks can't exceed peaks count, so that all have at least 1 peak
int N = peaksIndexList.size();

// from the "biggest possible number" to smaller number
for(int numBlocks =N; numBlocks >=1; numBlocks--){
Expand Down