Skip to content

Conversation

@pankaj-a-khandelwal-db
Copy link

Max number of blocks can't exceed peaks count, so that all have at least 1 peak. This also avoids looping when there are no peaks.

Max number of blocks can't exceed peaks count, so that all have at least 1 peak
Copy link

@TomaszSowa TomaszSowa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable N is used in other calculations, so it must be N = A.length;
But you can start the loop according to your idea:
for(int numBlocks = peaksIndexList.size(); numBlocks > 0; numBlocks--) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants