Easy Java Code || Beats 100%
Complexity\n- Time complexity:\nO(n)\n- Space complexity:\nO(1)\n# Code\n\nclass Solution {\n    public int distanceBetweenBusStops(int[] distance, int start, i
# Complexity\n- Time complexity:\nO(n)\n- Space complexity:\nO(1)\n# Code\n```\nclass Solution {\n    public int distanceBetweenBusStops(int[] distance, int start, int destination) {\n        int cwDistance = 0;\n        int totalDistance = 0;\n\n        for(int i=0; i<distance.length; i++){\n            if(start < destination && (i >= start && i < destination)){\n            cwDistance += distance[i];\n            }\n\n            if(start > destination && (i >= start || i < destination)){\n                cwDistance += distance[i];\n            }\n\n            totalDistance += distance[i];\n        }\n        return Math.min(cwDistance, totalDistance-cwDistance);\n    }\n}\n```
['Java']