Intercom - Product Engineer - II Experience (Dublin)
Anonymous User
2026

In this exercise, you'll build a system to assign conversations to customer support agents.

Task

Implement an AssignmentSystem class that has the following API:

  • Initializes with a list of available agents.
  • set_limit(agent_name, limit)
    • Sets the conversation limit for a specific agent.
  • assign(conversation_id)
    • Assigns a conversation to the next available agent.
  • preview_assignments(count)
    • Returns a list of agents who would be assigned conversations next.

Requirements

  • When assigning conversations, balance load evenly:
    • Assign new conversations to the agent with the fewest conversations
    • If there are ties, pick the agent who's been waiting the longest since their last assignment
  • Each agent has a maximum conversation limit (default is 2)

Example:

agents = ["Alice", "Bob", "Charlie"]
system = AssignmentSystem(agents)

system.set_limit("Bob", 4)
system.set_limit("Charlie", 3)

I want to know who will receive next 4 conversations
system.preview_assignments(4)
Output: ["Alice", "Bob", "Charlie", "Alice"]

Make some assignments
system.assign(101) # Assigns to Alice
system.assign(102) # Assigns to Bob
system.assign(103) # Assigns to Charlie
system.assign(104) # Assigns to Alice

I want to know who will receive next 5 conversations
system.preview_assignments(5)
['Bob', 'Charlie', 'Bob', 'Charlie', 'Bob']

Comments (8)