You are viewing a single comment's thread. Return to all comments →
Java 8:
public static List<Integer> breakingRecords(List<Integer> scores) { Integer mostRecord = 0, leastRecord = 0, minimumScore = scores.get(0), maximumScore = scores.get(0); for (Integer score : scores) { if (score < minimumScore) { leastRecord++; minimumScore = score; } else if (score > maximumScore) { mostRecord++; maximumScore = score; } } return Arrays.asList(mostRecord, leastRecord); }
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 8: