Imagine that you are monitoring changes to user ratings for an online platform. Each user on this platform has an overall rating (an integer between 1 and 2500) and a corresponding level. Rating levels are based on the following rules:
You are given an initial rating value and an array of integers changes representing changes to the rating. Your task is to calculate the final rating and return the level corresponding to that rating.
It is guaranteed that changes to the rating value will never result in it becoming less than 1 or greater than 2500.
Note: You are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(changes.length) will fit within the execution time limit.
Salesforce • Pending