Worker Assignment — Skills and Account Affinity
Updated
Problem statement
Assign support tasks to workers in input order.
Input
workers:"name,specialty".tasks:"id,duration,accountId,skills", whereskillsis a|-separated set of acceptable specialties.
For each task:
- Keep workers whose specialty appears in the task's skills.
- If any eligible worker has previously handled the same account, restrict candidates to those workers.
- Choose the candidate with the lowest accumulated workload; break ties by earlier position in
workers.
After assignment, add the task duration to the worker's workload and record that the worker has handled the account. If no worker has a required specialty, skip the task. Return successful assignments as "taskId:worker" in task order.
Practice sequence
- Part 1: balance workload
- Part 2: add specialties.
- Part 3: add account affinity (current).
Function
assignTasksAdvanced(workers: String[], tasks: String[]) → String[]Examples
Example 1
workers = ["Alice,payments","Bob,risk","Cara,payments"]tasks = ["t1,5,acct1,payments","t2,3,acct2,payments|risk","t3,4,acct1,payments|risk","t4,2,acct3,risk"]return = ["t1:Alice","t2:Bob","t3:Alice","t4:Bob"]t1 goes to Alice by input-order tie-break. t2 goes to Bob, the lowest-workload eligible worker. For t3, Alice has account affinity and is selected despite a larger workload. t4 requires risk and goes to Bob.
Example 2
workers = ["A,java","B,python"]tasks = ["x,2,c1,ruby","y,1,c1,java|python","z,1,c1,python"]return = ["y:A","z:B"]x is skipped because no worker has ruby. y ties at zero and chooses A. z requires python, so it goes to B; A's account history cannot override the skill requirement.
Constraints
- Worker names are unique and every worker has one specialty.
- Task IDs are unique and durations are non-negative integers.
- Task skill lists are non-empty and use
|as the delimiter. - Workers start with workload 0 and no account history.
- Input order breaks workload ties.
- A task with no eligible worker is skipped.
More Stripe Onsite Interview questions
- Render a Task Tree from CSV RowsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Invoice / Payment ReconciliationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Parse Boolean Rule ExpressionsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Transaction Rule Expression EvaluatorONSITE INTERVIEW · Seen Oct 2026
- Evaluate Ordered Action RulesPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- WebSocket Load Balancer — Parts 1–5OA · ONSITE INTERVIEW · Seen Sep 2026
- Rule-Driven Transaction Fraud DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
- Account Balance Manager Part 3 - Platform CoverageONSITE INTERVIEW · Seen May 2026
- Account Balance Manager Part 2 - Reject OverdraftsONSITE INTERVIEW · Seen May 2026
- Account Balance Manager Part 1 - Calculate TotalsONSITE INTERVIEW · Seen May 2026
Similar questions at other companies
- Design Authentication ManagerOracle · ONSITE INTERVIEWOracle interview questions
- Ad Score Scheduler With DelayGoogle · ONSITE INTERVIEWGoogle interview questions
- Thread-Safe Task Storage and Worker DispatchNuro · ONSITE INTERVIEWNuro interview questions
- Notification Deduplication WindowGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
- Helpdesk Ticket ProcessingThe Walt Disney Company · ONSITE INTERVIEWThe Walt Disney Company interview questions
- Execute Tasks by PrioritySnowflake · ONSITE INTERVIEWSnowflake interview questions
- 15-Minute Chat Session TrackerOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
- LRU Cache with TTLAutodesk · ONSITE INTERVIEWAutodesk interview questions
- Scheduled Payments with Account AliasesCoinbase · ONSITE INTERVIEWCoinbase interview questions
- Keyed Bounded Executor ScheduleMicrosoft · ONSITE INTERVIEWMicrosoft interview questions