Algorithm · Amazon · Medium
A network of fulfillment centers is linked by delivery routes. Implement find_eligible_warehouses(roads, target, maxDist, inventory), which returns the IDs of every center able to send stock to the center that is running short. The parameters are: roads is a list of pairs [u, v]. Each pair is a delivery route between centers u and v, and every route can be traveled in both directions. target is the ID of the center that needs inventory. maxDist is the largest number of…