Practice Design Task Manager
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Implement TaskManager for tasks identified by taskId and assigned to users with priorities. The constructor TaskManager(tasks) loads triples [userId, taskId, priority]. add(userId, taskId, priority) adds a previously absent taskId. edit(taskId, newPriority) changes an existing task’s priority, and rmv(taskId) deletes an existing task. execTop() removes the task with greatest priority across all users, breaking ties by greatest taskId, and returns its userId; return -1 when no tasks remain. A user can own multiple tasks.
Source: Design Task Manager on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
["TaskManager", "add", "edit", "execTop", "rmv", "add", "execTop"] [[[[1, 101, 10], [2, 102, 20], [3, 103, 15]]], [4, 104, 5], [102, 8], [], [101], [5, 105, 15], []]
[null, null, null, 3, null, null, 5]
Constraints
Related LeetCode Problems
Practice more problems similar to Design Task Manager.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.