Javascript Interview Questions: Breaking Records from HackerRank

Published: 09 August 2020
on channel: Papa Santo
1,082
22

Two solutions: 1. for loop 2. Recursion with a helper function
Share your solution in the comments!

View answers: https://playcode.io/648699/

// TEST CASES:
// Test case # 1:
// breakingRecords([3, 4, 21, 36, 10, 28, 35, 5, 24, 42]) // [4, 0]
// Test case # 2:
// breakingRecords([10, 5, 20, 20, 4, 5, 2, 25, 1]) // [2, 4]

// INSTRUCTIONS:
// You are a basketball player.
// Above is an array representing the amount of points you scored each game
// The array is ordered from first game to last game
// highscore = How many times did you score over your highest score?
// lowscore = How many times did you score under your lowest score?
// Return the result in this format [highscore, lowscore]

// SUDO CODE:

// create variables for max, min, highScore, and lowScore

// loop through the scores array

// if a score is higher than max, make that score the max and iterate
// highscore up by one

// if a score is lower than min, make that score the min and iterate
// lowscore up by one

// return or console log the results in an array [highScore, lowScore]


On this page of the site you can watch the video online Javascript Interview Questions: Breaking Records from HackerRank with a duration of hours minute second in good quality, which was uploaded by the user Papa Santo 09 August 2020, share the link with friends and acquaintances, this video has already been watched 1,082 times on youtube and it was liked by 22 viewers. Enjoy your viewing!