Algorithm · Stripe · Medium
You are building the control plane of a request router that spans datacenters around the globe. Every incoming client request carries a latitude and a longitude, and the router's job is to dispatch it to the nearest datacenter that is healthy and still has room for more load. Implement this as a small command-driven system with entry point router_main(): it processes a sequence of text commands, one command per line, and produces exactly one line of output for each command.…