Simple O(n) Solution Java
\n\n\n\nclass Solution {\n    public int distanceBetweenBusStops(int[] distance, int start, int destination) {\n        int n = distance.length;\n        int di
![image](https://assets.leetcode.com/users/images/908fb04f-b575-4c05-ad98-a8a528589abe_1662054222.4423125.png)\n\n\n```\nclass Solution {\n    public int distanceBetweenBusStops(int[] distance, int start, int destination) {\n        int n = distance.length;\n        int dist = 0;\n        int sum = 0;\n        \n        for(int el : distance) sum += el;\n        \n        if(destination>start){\n            for(int i=start;i<destination;i++) dist += distance[i];\n        }\n        else{\n            for(int i=destination;i<start;i++) dist += distance[i];\n        }\n        \n        int ans = Math.abs(sum - dist);\n        \n        return Math.min(dist,ans);\n    }\n}\n```
['Java']