Problem · Array
Rating Level After Changes
Learn this problemProblem statement
You are given an integer initial, representing a user's initial rating, and an integer array changes. Apply every value in changes to the rating in order.
After all changes have been applied, return the level corresponding to the final rating:
rating < 1000:"beginner"1000 ≤ rating < 1500:"intermediate"1500 ≤ rating < 2000:"advanced"2000 ≤ rating:"pro"
Function
ratingLevelAfterChanges(initial: int, changes: int[]) → StringExamples
Example 1
initial = 1500changes = [-100,-300,450,500,-500,-600]return = "beginner"The rating changes as follows: 1500 → 1400 → 1100 → 1550 → 2050 → 1550 → 950. Since 950 < 1000, the final level is "beginner".
Constraints
1 ≤ initial ≤ 2500- Applying the values in
changesnever makes the rating less than1or greater than2500. - The visible source states that
O(changes.length^2)time fits within the execution limit.
More Tiktok problems
- Concatenate Digit-wise SumsOA · Seen Aug 2026
- Count 2x2 Submatrices by Black CellsOA · Seen Aug 2026
- Count House Segments After DestructionOA · Seen Aug 2026
- Debugger Breakpoint ActionsOA · Seen Aug 2026
- Distribution Center Package AllocationOA · Seen Aug 2026
- Find All Local PeaksOA · Seen Aug 2026
- Minimum Height Difference Between Distant PeaksOA · Seen Aug 2026
- Minimum Operations for Stepwise StructuresOA · Seen Aug 2026