Anthropic OA, task manager design problem
Result: Pending Number of Rounds: 1
Sharing the Anthropic OA problem. Design-heavy but not algorithmically complex.
You implement a TaskManager class with three operations: add a task by name and priority, update a task by ID, and retrieve a task's current state. addTask returns a sequentially assigned ID. Duplicates are allowed, two tasks with identical name and priority both get distinct IDs. getTask returns an empty string for missing IDs; updateTask signals whether the ID was found.
Each method accepts a timestamp parameter that isn't used in the base version. Interviewer mentioned it's scaffolding for a follow-up.
Follow-up I got: how do you make this thread-safe given multiple writers calling addTask simultaneously? I used an atomic counter for the ID and a concurrent map for storage. That seemed to land well. Interviewer also asked about search by priority, which would require an additional index structure.
Overall pretty approachable as an OA. The timestamp parameter being unused is probably a setup for follow-ups, so don't ignore it when it comes up.
Submitted last week, waiting to hear if I'm moving to phone screen.