Circular Bus Route Distance
IntuitionThe problem involves finding the shortest distance between two bus stops on a circular route. My initial thought was to calculate the total distance ar
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem involves finding the shortest distance between two bus stops on a circular route. My initial thought was to calculate the total distance around the circle and then find the shorter distance between the start and destination points in both clockwise and counterclockwise directions.\n\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTo solve this problem, we first calculate the total distance around the circle by summing up all the distances between consecutive bus stops. Then, we calculate the distance between the start and destination points in both clockwise and counterclockwise directions. Finally, we return the minimum of these two distances.\n\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def distanceBetweenBusStops(self, distance: List[int], start: int, destination: int) -> int:\n        total : int = sum(distance)\n        data_length : int = len(distance)\n        path : int = 0\n\n        index : int = start\n        if start > destination:\n            while True:\n                if index == data_length:\n                    index = 0\n                    \n                if index == destination:\n                    break\n\n                path += distance[index]\n                index += 1\n\n        else:\n            for index in range(start, destination):\n                path += distance[index]\n\n        return min(total - path, path)\n```
['Python3']