Created
November 9, 2019 05:02
-
-
Save moonformeli/1dadab988f019bc4f7e4c0f419232754 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function breakingRecords(scores) { | |
let min = scores[0]; | |
let max = scores[0]; | |
var minCount = 0; | |
var maxCount = 0; | |
for (var i = 1; i < scores.length; i += 1) { | |
if (scores[i] > max) { | |
max = scores[i]; | |
maxCount += 1; | |
} | |
if (scores[i] < min) { | |
min = scores[i]; | |
minCount += 1; | |
} | |
} | |
return [maxCount, minCount]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment