You are viewing a single comment's thread. Return to all comments →
public static List<Integer> breakingRecords(List<Integer> scores) { // Write your code here Integer min = 0; Integer max = 0; Integer tempMin = 0; Integer tempMax = 0; for (int i = 0 ; i < scores.size() ; i ++){ if(i == 0){ tempMin = scores.get(i); tempMax = scores.get(i); }else { if(scores.get(i) > tempMin && scores.get(i) > tempMax){ tempMax = scores.get(i); max ++; } else if (scores.get(i) < tempMin && scores.get(i) < tempMax){ tempMin = scores.get(i); min ++; } } } List<Integer> result = new ArrayList<>(); result.add(max); result.add(min); return result; }
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 →