We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Breaking the Records
- Discussions
Breaking the Records
Breaking the Records
Sort by
recency
|
178 Discussions
|
Please Login in order to post a comment
javascript
Explanation: I initialized min and max score to her first game score, and initialized my output array "arr" with the values "[0,0]" . "arr[0]" represents number of times minimum score record is broken and "arr[1]" represents the number of times her maximum score record is broken , then i iterated from second index 'scores[1]' and firstly checked if her min score (which is initially her first game score) is less than her next game score, if so i incremented 'arr[0]' by 1 and changed the value of her min score to the present score then secondly, i checked if her max score (which is also initially her first game score) is greater then next game score, if so i incremented the "arr[1]" by 1 and changed her min score to the present score. then did this to the last index and returned the array "arr".
Java:
Typscript