Consistent-Hash Order Router with Virtual Nodes

Asked at DoorDash · Coding Questions · Difficulty: Medium · Last asked Jun 11, 2026

Orders must be assigned to delivery workers so that the assignment of an order stays stable when the set of workers changes. Build a router based on consistent hashing: each worker is placed on a hash ring through several virtual nodes, and an order goes to the first virtual node clockwise from the hash of the order key.

Loading the problem…