Algorithm · Amazon · Medium
Requirements There are n stops positioned around a circle. distance[i] gives the weight of the edge from stop i to stop (i + 1) % n. A sequence of queries (start, end) is provided. For every query, determine the smaller distance of the two paths connecting the two stops around the circle. Return the sum of the shortest-path distance for every query. The same circular route is reused across many queries, so the implementation should avoid walking along the route separately…
Checking your access…