Codility
Codility copied to clipboard
My Solutions to Codility (100% performance)
Results
2
Codility issues
Sort by
recently updated
recently updated
newest added
I think in this part of code else{ // note: need to minus "1" // because the rightEnd is not included numTriangle = numTriangle + (rightEnd - leftEnd - 1);...
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.