← 返回 roblox 的题目列表Highest-Earning Experience Tracker
类型:qbank
Build a streaming tracker over update/query operations: each update mutates an experience's running profit by a delta; each query returns the name of the experience with the current highest total. Tests the classic streaming-top-1 / max-heap pattern with stale-entry pruning.
Examples
Example 1:
Input: operations = ["U","U","Q","U","Q"] experiences = ["adopt-me","blox-fruits","","adopt-me",""] deltas = [100, 200, 0, 150, 0]
Output: ["blox-fruits","adopt-me"]
Explanation:
After the first two updates: adopt-me = 100, blox-fruits = 200. First query returns "blox-fruits". After the third update: adopt-me = 250, blox-fruits = 200. Second query returns "adopt-me".
Example 2:
Input: operations = ["U","U","Q"] experiences = ["beta","alpha",""] deltas = [50, 50, 0]
Output: ["alpha"]
Explanation:
Both experiences have profit 50. Tie-break by lexicographic order returns "alpha".
Example 3:
Input: operations = ["U","U","Q","U","Q"] experiences = ["x","x","","x",""] deltas = [100, -30, 0, -100, 0]
Output: ["x","x"]
Explanation:
After deltas, x has profit 70, then 70, then -30. x is always the only experience, so it wins every query — even with negative profit.
Constraints
1 <= operations.length <= 10^5
operations.length == experiences.length == deltas.length
operations[i] is either "U" or "Q".
Experience names consist of lowercase letters, digits, and -, with 1 <= name.length <= 32.
-10^6 <= deltas[i] <= 10^6.
For a "Q" operation, experiences[i] and deltas[i] are unused (may be "" and 0).