intercom logo
Intercom· Product Engineer - II

Intercom - Product Engineer - II Experience (Dublin)

Location
Dublin
Posted
25 Jun 2025
604 reads

Summary

This post details a coding interview problem from Intercom where I was tasked with designing and implementing an AssignmentSystem to distribute customer conversations among support agents efficiently, considering individual limits and load balancing rules.

How it went

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']

Questions asked (1)

  1. 01

    Conversation Assignment System

    Data Structures & Algorithms · Medium

    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']

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Intercom recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!