Java O(n) solution -- Easy to understand
Make sure start comes before end;\n2. Caculate the sum of target interval as well as the total sum;\n3. The result will be the min of target interval sum and th
1. Make sure start comes before end;\n2. Caculate the sum of target interval as well as the total sum;\n3. The result will be the min of target interval sum and the remaining interval sum.\n```\nclass Solution {\n    public int distanceBetweenBusStops(int[] distance, int start, int destination) {\n        if (start > destination) {\n            int temp = start;\n            start = destination;\n            destination = temp;;\n        }\n        int res = 0, total = 0;\n        for (int i = 0; i < distance.length; i++) {\n            if (i >= start && i < destination) {\n                res += distance[i];\n            }\n            total += distance[i];\n        }\n        return Math.min(res, total - res);\n    }\n}\n\n```
[]