• + 0 comments

    JAVA Solution

    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;
    }