You are viewing a single comment's thread. Return to all comments →
In C# 100%
public static List<int> breakingRecords(List<int> scores) { int bestBreaks = 0; int worstBreaks = 0; int maxScore = scores[0]; int minScore = scores[0]; for (int i = 1; i < scores.Count; i++) { if (scores[i] > maxScore) { maxScore = scores[i]; bestBreaks++; } if (scores[i] < minScore) { minScore = scores[i]; worstBreaks++; } } return new List<int> { bestBreaks, worstBreaks }; }
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Breaking the Records
You are viewing a single comment's thread. Return to all comments →
In C# 100%