Company: Uber
Difficulty: medium
Rating Changes Tracker Suppose you track a skill rating on some online platform that moves up or down after every match. Your rating begins at 1500, and each entry in a log records how much it moved. Return an array with two numbers - the highest value the rating ever reached, and the value it holds after the last entry. Note: It is guaranteed that your rating never changed to a negative value. Also, note that you are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(diffs.length²) will fit within the execution time limit. Input Format An array diffs containing the rating changes over time. Output Format Return an array containing two numbers: [highest_rating, current_rating] Examples Example 1: Input: diffs = [100, -200, 350, 100, -600] Output: [1850, 1250] Explanation: Walking through the rating after each logged change gives: 1500 - starting rating 1500 + 100 = 1600 1600 - 200 = 1400 1400 + 350 = 1750 1750 + 100 = 1850 - the peak