Javascript easy solution
Approach\n Describe your approach to solving the problem. \nfirst we need to find the distance in clockwise. then find the distance of anticlockwise by subtract
# Approach\n<!-- Describe your approach to solving the problem. -->\nfirst we need to find the distance in clockwise. then find the distance of anticlockwise by subtracting the sum of distance with clockwise distance.\n\nthen return the shortest distance\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n)\n\n\n\n# Code\n```\n/**\n * Calculates the distance between bus stops either in the clockwise or anti-clockwise direction.\n * Returns the shortest distance between the start and destination bus stops.\n * @param {number[]} distance - Array representing the distance between each pair of consecutive bus stops.\n * @param {number} start - Index of the start bus stop.\n * @param {number} destination - Index of the destination bus stop.\n * @returns {number} - Shortest distance between the start and destination bus stops.\n */\n\n\n\nvar distanceBetweenBusStops = function (distance, start, destination) {\n  let result = 0;\n  let result2 = 0;\n  let sum = 0;\n  if (start > destination) {\n    [start, destination] = [destination, start]\n  }\n\n  result=clockWise(distance, start, destination);\n  result2=antiClockWise(distance,result)\n  const output = result > result2 ? result2 : result;\n  return output\n  };\n\nconst clockWise = (distance, start, destination) => {\n  let result=0;\n  for (let i = start; i < destination; i++) {\n    result = result + distance[i];\n  }\n  return result\n}\n\nconst antiClockWise = (distance,result)=>{\n  let sum=0;\n  let result2;\n    for (let j = 0; j < distance.length; j++) {\n    sum = sum + distance[j];\n  }\n  result2 = sum - result;\n  return result2\n}\n\n```
['Array', 'JavaScript']