Assign Expert Tasks by Domain With Capacity Limits

Last updated: November 29, 2026

Quick Overview

Each AI-training task needs an expert from a specific domain, and each expert has domains, a quality rating and a capacity; assign tasks in deadline order to the least-loaded eligible expert (ties to the higher rating) and report tasks that cannot be placed.

Micro1
Coding & Algorithms
Software Engineer
Micro1
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Each AI-training task needs an expert from a specific domain, and each expert has domains, a quality rating and a capacity; assign tasks in deadline order to the least-loaded eligible expert (ties to the higher rating) and report tasks that cannot be placed.

micro1 staffs human-data projects for AI labs from a large network of vetted domain experts, so routing work fairly and fast is a real backend problem. The interviewer checks heap usage, lazy invalidation when an expert sits in several domain pools, and clear policies.

What the Interviewer Expects
  • Orders tasks by deadline with a deterministic tie-break
  • Keeps one min-heap per domain keyed by (load, -rating, id)
  • Handles experts that appear in several domain heaps with lazy invalidation
  • Drops experts from heaps once they hit capacity
  • Returns unassigned tasks instead of failing silently
  • Analyzes complexity in terms of tasks and expert-domain pairs
Key Topics to Cover
Heaps
Lazy deletion
Greedy assignment
Load balancing
Bipartite matching
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you change this to maximize the number of assigned tasks rather than greedy deadline order?
  • How would you add a rule that one expert cannot both create and review the same task?
  • What if ratings update in real time while assignment runs?
  • How would you shard this across regions or time zones?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Experts: {id: (domains, rating, capacity)}. Tasks: (task_id, domain, deadline). Policy: process tasks by earliest deadline; pick the eligible expert with the fewest assigned tasks, breaking ties t...

High-Level Design

Build a min-heap per domain with entries (load, -rating, id). When I assign an expert, I push a fresh entry only into that task's domain heap, so their entries in other domains go stale. On pop I co...


Submit Your Answer
Markdown supported

Related Questions