← 返回 anthropic 的题目列表Route Multiple Prompt Calls to Multiple GPT Servers Using a Hash Table
类型:online_judge
Problem: Route Multiple Prompt Calls to Multiple GPT Servers Using a Hash Table
You are given multiple GPT servers and a sequence of prompt call requests. Implement a routing/scheduling logic:
Use a hash table (dictionary) to maintain a prompt -> server mapping.
When a prompt appears for the first time, assign it to a server and store the mapping.
When the same prompt appears again, it must be routed to the same server as the first assignment (sticky routing / affinity).
Output the server chosen for each call.
Note: The original post does not provide key details (e.g., how to choose a server on first assignment, exact I/O format, whether load balancing is required, server churn, scaling strategy). Therefore it cannot be completed into a fully spec’d, directly answerable coding problem and those parts are omitted as requested.