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.
public static List breakingRecords(List scores) {
// Write your code here
int max = scores.get(0);
int min = scores.get(0);
int maxCount = 0;
int minCount = 0;
for(int i = 1; i<scores.size(); i++){
int currentScore = scores.get(i);
if(currentScore > max){
max = currentScore;
maxCount++;
}else if(min > currentScore){
min = currentScore;
minCount++;
}
}
List<Integer> res = new ArrayList<>();
res.add(maxCount);
res.add(minCount);
return res;
}
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 Solution
public static List breakingRecords(List scores) { // Write your code here