Shortest Multi-Zone Delivery Route
Shortest Multi-Zone Delivery Route
Zomato delivery executive Priya must collect food from at least one restaurant in each zone before delivering to customer. Given zone coordinates and delivery location, find shortest route visiting minimum one restaurant per zone. Rule: pick exactly one restaurant per zone; visit them in zone order (zone 1 first), then the delivery point. Distance is Manhattan. Return the minimum total distance. Your solve(...) function receives the inputs as ready-made arguments — no input reading or parsing needed; just return the answer.
Approach
Start at the delivery point and visit at least one coordinate from EACH zone (any order). Return the minimum total Manhattan distance travelled (sum of |dx|+|dy| between consecutive stops; no return to start). solve(zones, delivery).
Input
Output
More Arrays problems
Browse all coding problems →Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards