Minimum Delivery Time on Circular Ring
Given m nodes arranged in a circular ring where a drone can move to adjacent nodes with given transition times, calculate the minimum total travel time for the drone to fulfill all delivery requests starting from node 1.
Asked at:
Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late March, 2026
Amazon
Senior
There are m nodes arranged in a circular ring (node 1 is adjacent to node m). A drone can move to either adjancent node, and the travel time between node i and its neigbors is given by transitionTime[i]. Starting from node 1, your task is to calculate the minimum total travel time required for the drone to fulfill all travel requests. Example: m = 3, n = 3 transitionTime = [3,2,1] requestedNodes = [1,3,3,2] The drone begins at node 1, 1. To move to node 1, no time needed. 2. To move to node 3 from node 1, there are 2 possible routes: - clockwise 1 -> 2 -> 3, it takes 5 seconds - counterclockwise: 1 -> 3, which takes 3 seconds 3. To move to node 3, 0 seconds 4. To move from node 3 to node 2: - clockwise: 3 -> 1 -> 2, which takes 4 seconds - counterclockwise: 3 -> 2, it takes 1 second Hence the total minimum possible time to visit all required nodes is 4 seconds Constraints: 1 <= n <= 10^5 1 <= requestedNodes[i] <= m 1 <= m <= 5000 1 <= transitionTime[i] <= 10^6
Hello Interview Premium
Your account is free and you can post anonymously if you choose.