• + 0 comments

    my java solution:

    public static List<Integer> breakingRecords(List<Integer> scores) {
        // Write your code here
        List<Integer> list = new ArrayList();
        
        int tempMax= scores.get(0);
        int tempMin = tempMax;
        
        int highestScore =0;
        int lowestScore =0;
        
        for (Integer i : scores) {
            if(i > tempMax){
                highestScore++;
                tempMax = i; 
            }else if(i < tempMin){
                 lowestScore++;
                tempMin = i; 
            }
        }
    
        list.add(highestScore);
        list.add(lowestScore);
        
        return list;
        }