Maria plays college basketball and wants to go pro.
Each season she maintains a record of her play.
She tabulates the number of times she breaks her season record for most points
and least points in a game.
Points scored in the first game establish her record for the season, and she begins counting from there.
She broke her careerhigh 2 times, and careerlow 4 times.
Thus return 2 4
.
INPUT
10
3 4 21 36 10 28 35 5 24 42
OUTPUT
4 0
function breakingRecords(scores) {
let careerLow = scores[0];
let careerHigh = scores[0];
let recordsCounter = [0, 0];
scores.forEach((score) => {
if(score > careerHigh) {
careerHigh = score;
recordsCounter[0]++;
}
if(score < careerLow) {
careerLow = score;
recordsCounter[1]++;
}
});
return [recordsCounter[0], recordsCounter[1]];
}