All practice tasks

Low Level Design

Low-Level Design: Routing

Deliver notifications through preferred channels and deduplicate messages by ID.

Interface

Export create_notification_router(channels), which returns async route(message). channels maps names to async handlers. A message is a dictionary with id and preferred_channels. With only email registered, ["sms", "email"] routes to email.

Implement the contract in the supplied source file using Python 3. Discuss framework integration in design.md.

Behavior

  • [N1] Choose the first preferred name with a callable handler. Call it with the original message fields. Raise LookupError if no handler is supported.
  • [N2] Propagate handler exceptions and clear pending state so a later call can retry. Do not fall through to another handler after an exception.
  • [N3] A new success returns {"channel": name, "duplicate": false}. In-flight duplicates join the first attempt, and later duplicates reuse the successful channel. Both return duplicate true on success regardless of their preferences. Joined requests share failures.
  • [N4] Raise ValueError before dispatch for a missing or empty ID or an ID that is not a string. Instances have independent state. Callers use a single event loop and do n

What this task practices

Low-Level Design: Routing is a low level design interview exercise that trains prompt interpretation, explicit assumptions, a concrete response, and a clear explanation of tradeoffs. The catalog marks it as medium difficulty. It focuses on Testing, Tradeoffs, Validation. The signed-in workspace provides the tools for the round and evaluates the attempt against task-specific criteria. Reference solutions, hidden checks, evaluator instructions, and candidate work remain private.

Sign in to startThe workspace and evaluation open after sign in.