JS easy solution with O(n)
\nvar distanceBetweenBusStops = function(distance, start, destination) {\n    let totalDistance = 0;\n    let output = 0;\n    \n    for (let i = 0; i < distanc
```\nvar distanceBetweenBusStops = function(distance, start, destination) {\n    let totalDistance = 0;\n    let output = 0;\n    \n    for (let i = 0; i < distance.length; i++) {\n        totalDistance += distance[i];\n        \n        if (start < destination) {\n            if (i + 1 > start && i + 1 <= destination) {\n                output += distance[i];\n            }\n        } else if (start > destination) {\n            if ((i + 1 <= destination) || (i + 1 > start)) {\n                output += distance[i];\n            }\n        } else {\n            return 0;\n        }\n    }\n\n    return Math.min(output, totalDistance - output);\n};\n```
['JavaScript']