Find the optimal delivery cost between two cities for each query.
Unlock detailed company stats for this questionUpgrade
There are n cities, each with a delivery charge given by the array deliveryCharge. Delivering from city i to city j costs abs(deliveryCharge[i] - deliveryCharge[j]), or 1 unit if city j is the closest city to city i (distance between two cities is abs(deliveryCharge[i] - deliveryCharge[j]); each city has a unique closest city). Given an array of queries [Start, End], return the optimal cost to deliver from Start to End.
Community answers
No answers contributed by the community yet.
Related questions
Find the round-trip cost between two cities with asymmetric edge costs.Find the minimum cost to connect fromServer[i] to toServer[i] for each query.Related courses

Course

Course
Course
