Track Maximum and Current Rating
Updated
Problem statement
Your rating starts at 1500. Apply every signed value in changes from left to right.
Return a two-element array containing:
- the maximum rating observed, including the initial rating; and
- the final rating after every change.
Function
trackRatingExtremes(changes: int[]) → int[]Examples
Example 1
changes = [100,-200,350,100,-600]return = [1850,1250]The ratings are 1500, 1600, 1400, 1750, 1850, 1250. The maximum is 1850 and the final rating is 1250.
Example 2
changes = []return = [1500,1500]With no changes, both the maximum and final ratings remain at the initial value.
Constraints
0 <= changes.length <= 100000-100000 <= changes[i] <= 100000- Every intermediate rating fits in a signed 32-bit integer.
More ZipRecruiter Online Assessment questions
- Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
- Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
- Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
- Minimum Changes to Draw a YOA · Seen Oct 2024
- Apply Binary State OperationsOA · Seen Sep 2024
- Simulate Orchard Rot SpreadOA · Seen Sep 2024
- Compare Odd- and Even-Index SumsOA · Seen Sep 2024
- Coordinate Removals with Column GravityOA · Seen Sep 2024
- Lexicographically Smallest End ReversalOA · Seen Sep 2024
- Recursively Expanded Shell Command CountsOA · Seen Sep 2024
Similar questions at other companies
- Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Book Reading EveningsGoogle · OAGoogle interview questions
- Basic Item DiscountsPalantir · OAPalantir interview questions
- Wind-Blown Leaves Remaining in a GridAbridge · OAAbridge interview questions
- Lift Total TravelInfosys · OAInfosys interview questions
- Shell Command Counts with History ReferencesTikTok · OATikTok interview questions
- Count Dropped RequestsJP Morgan Chase · OAJP Morgan Chase interview questions
- Recursively Expanded Shell Command CountsHudson River Trading · OAHudson River Trading interview questions
- Diagonal Bounce TraversalAutodesk · OAAutodesk interview questions
- First Value Below Both NeighborsCapital One · OACapital One interview questions