We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
publicstaticList<Integer>breakingRecords(List<Integer>scores){// Write your code hereinthighestScore=scores.get(0);intlowestScore=scores.get(0);intmaxRecordBreaks=0;intminRecordBreaks=0;for(inti=1;i<scores.size();i++){intcurrentScore=scores.get(i);if(currentScore>highestScore){highestScore=currentScore;maxRecordBreaks++;}if(currentScore<lowestScore){lowestScore=currentScore;minRecordBreaks++;}}List<Integer>recordBreaks=newArrayList<>();recordBreaks.add(maxRecordBreaks);recordBreaks.add(minRecordBreaks);returnrecordBreaks;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Breaking the Records
You are viewing a single comment's thread. Return to all comments →
Java 15