Drone Delivery Route
Learn this problemProblem statement
( ദ്ദി ˙ᗜ˙ ) Special thanks to the friends who shared these fresh last-seen signals! (07-08-2026, 07-31-2026 & 08-13-2026 :D)
Amazon is expanding its next-generation drone delivery network, consisting of m hubs arranged in a circular ring. Hub 1 is adjacent to Hub m. A drone can move to either adjacent hub, and the travel time between Hub i and its neighbors is given by transitionTime[i].
Amazon receives a list of priority delivery requests, where packages must be picked up or delivered to specific hubs in a given sequence, represented by the array requestedHubs of size n.
Starting from Hub 1, calculate the minimum total travel time required for the drone to fulfill all delivery requests.
Note: Use 1-based indexing.
Function
getMinimumDroneTime(transitionTime: int[], requestedHubs: int[]) → longExamples
Example 1
transitionTime = [3,2,1]requestedHubs = [1,3,3,2]return = 4The drone begins its journey at Hub 1.
- The first hub to visit is Hub
1itself, so it takes0seconds to complete this step. - To move from Hub
1to Hub3, the drone has two possible routes:- Clockwise:
1 -> 2 -> 3, which takestransitionTime[1] + transitionTime[2] = 3 + 2 = 5seconds. - Counterclockwise:
1 -> 3, which takestransitionTime[1] = 3seconds. - The shorter route is the counterclockwise path, so the drone reaches Hub
3in3seconds.
- Clockwise:
- The drone is already at Hub
3, so it takes0seconds to complete this step. - To move from Hub
3to Hub2, the visible source shows the clockwise route3 -> 2, which takestransitionTime[3] = 1second.
FastPrep inferred the output 4 from the visible steps: 0 + 3 + 0 + 1 = 4. The screenshot cuts off before the official final output. If you know it, feel free to tell us and we will update it. Thanks a lot in advance! We will also improve this part if we find a clearer source later. (2026-06-24 :)