You are viewing a single comment's thread. Return to all comments →
public static List<Integer> breakingRecords(List<Integer> scores) { int highScoreCount=0; int lowScoreCount=0; ArrayList<Integer> answers = new ArrayList<>(); int highestScore=scores.get(0); int lowestScore=scores.get(0); for(int i=1; i<scores.size(); i++) { if(scores.get(i)>highestScore) { highestScore=scores.get(i); highScoreCount+=1; } if(scores.get(i)<lowestScore) { lowestScore=scores.get(i); lowScoreCount+=1; } } answers.add(highScoreCount); answers.add(lowScoreCount); return answers; } }
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 →