← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You're tracking cumulative earnings for a list of Roblox experiences (games) over time. Process a sequence of operations and, for each query operation, return the name of the experience with the highest cumulative earnings.
Operations:
"U" (Update): add deltas[i] to experiences[i]'s total earnings."Q" (Query): return the name of the experience with the highest current earnings. If multiple experiences are tied, return any one of them (deterministically pick the most recently updated one).Inputs:
operations: list of "U" / "Q" strings of length Nexperiences: list of N strings; for "U", the experience name; for "Q", the empty string ""deltas: list of N integers; for "U", the earnings delta (can be negative); for "Q", ignored (use 0)Output: A list of strings, one per "Q" operation, in order.
Example: ` operations = ["U", "U", "Q", "U", "Q"] experiences = ["a", "b", "", "c", ""] deltas = [10, 20, 0, 30, 0]
After "U a 10": {a:10} -> max = a After "U b 20": {a:10, b:20} -> max = b "Q" -> "b" After "U c 30": {a:10, b:20, c:30} -> max = c "Q" -> "c"
Output: ["b", "c"] `
Tie-break: if multiple experiences have the same earnings on a "Q", return the most recently updated one (latest "U" index).