• + 0 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);
        }