Problem Statement
Download or view the problem statement here.
Solution
static int[] breakingRecords(int[] scores) { int min = scores[0], max = scores[0]; int minCount = 0, maxCount = 0; int len = scores.length; for (int i = 0; i < len; i++) { if (scores[i] < min) { min = scores[i]; minCount++; } if (scores[i] > max) { max = scores[i]; maxCount++; } } return new int[]{maxCount, minCount}; }