Specify Proximity-Based Request Routing
StripeSoftware Engineer · Online AssessmentLast updated
Clarify proximity metrics, destination eligibility, tie rules, and capacity before designing a request-routing algorithm.
Design proximity-based request routing. Explain what information a request and a destination must provide, how proximity is measured, and how the routing decision should account for unavailable or unsuitable destinations.
Constraints
Only the proximity-routing objective is supplied. The distance metric, destination eligibility, capacity, tie rule, and output format are unresolved. Do not infer a particular external routing problem. Any concrete selection algorithm must be tied to explicitly stated assumptions.
Clarifying Questions
- Does proximity mean geographic distance, network latency, topology distance, or another score?
- Which destinations are eligible, and are health and capacity constraints part of selection?
- How are ties and the absence of an eligible destination handled?
- Are inputs a fixed snapshot or changing while requests are routed?
Hints
Hint 1
Filter before optimizing the score: The nearest destination is useful only if it is allowed and able to serve the request under the declared policy.
Follow-up questions
- When would a spatial index help, and when would it be irrelevant?
- How would you avoid routing every request to one nearby destination?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.