You are viewing a single comment's thread. Return to all comments →
my java solution :
public static List<Integer> breakingRecords(List<Integer> scores) { int n = scores.size(); int min = scores.get(0), max = scores.get(0); int maxCounter = 0, minCounter = 0; List<Integer> output = new ArrayList<>(2); for (int i = 1 ; i < n ; i++) { if(scores.get(i) > max) { maxCounter++; max = scores.get(i); } else if(scores.get(i) < min) { minCounter++; min = scores.get(i); } } output.add(maxCounter); output.add(minCounter); return output; }
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 →
my java solution :