Simple C++ || 100% efficient || Just 2 mins reading to understand
Explanation of the Code:\n\n## Initialization:\nThe function distanceBetweenBusStops takes three parameters:\ndistance: A vector representing distances between 
# Explanation of the Code:\n\n## Initialization:\nThe function distanceBetweenBusStops takes three parameters:\ndistance: A vector representing distances between consecutive bus stops.\nstart: The index of the starting bus stop.\ndestination: The index of the destination bus stop.\nIt initializes dist_clock and dist_aclock to 0 to accumulate distances for clockwise and counterclockwise paths respectively.\nsize is set to the size of the distance vector.\n## Determining Start and Destination Indices:\nstart1 and destination1 are calculated to determine the actual range of bus stops to consider based on start and destination:\nstart1 is set to min(start, destination).\ndestination1 is set to max(start, destination).\nThis ensures that we iterate through the bus stops in the correct direction regardless of the order of start and destination.\n## Calculating Distances:\nIterate through the distance vector using index i.\nIf i is within the range [start1, destination1):\nAdd distance[i] to dist_clock to accumulate the clockwise distance.\nOtherwise:\nAdd distance[i] to dist_aclock to accumulate the counterclockwise distance.\n## Returning Result:\nAfter iterating through all distances, compare dist_clock and dist_aclock.\nReturn the minimum of these two values as the shortest distance between the start and destination bus stops, either clockwise or counterclockwise.\n\n# Complexity\n- Time complexity:\nO(N) + O(logN)\n- Space complexity:\nO(1)\n# Code\n```\nclass Solution {\npublic:\n    int distanceBetweenBusStops(vector<int>& distance, int start, int destination) {\n        int dist_clock = 0, dist_aclock = 0, size = distance.size();\n        int start1 = min(start, destination), destination1 = max(start, destination);\n        \n        // Iterate through the array of distances to calculate clockwise and counterclockwise distances\n        for (int i = 0; i < size; i++) {\n            if (i >= start1 && i < destination1)\n                dist_clock += distance[i]; // Accumulate distance for clockwise direction\n            else\n                dist_aclock += distance[i]; // Accumulate distance for counterclockwise direction\n        }\n        \n        // Return the minimum distance between clockwise and counterclockwise paths\n        return min(dist_clock, dist_aclock);\n    }\n};\n\n```
['C++']