JAVA || 100% fast || Code with Comments
Java Code\n\nclass Solution {\n    public int distanceBetweenBusStops(int[] distance, int start, int destination) {\n        int clockwise = 0, counterclockwise
**Java Code**\n```\nclass Solution {\n    public int distanceBetweenBusStops(int[] distance, int start, int destination) {\n        int clockwise = 0, counterclockwise = 0;\n        int n = distance.length;\n        \n        // count of total number of stops in clockwise manner from start to destination \n        int cl = (n + destination - start) % n;\n        \n        // count of total number of stops in anti-clockwise manner from start to destination \n        int acl = (n - cl);       \n        \n        // calculate the clockwise distance from by going from start to destination\n        // we have `cl` number of stops by going in clockwise fashion\n        for(int i = 0; i < cl; i++)\n            clockwise += distance[(start + i) % n];\n        \n        // calculate the anti-clockwise distance from by going from destination to start\n        // we have `acl` number of stops by going in anti-clockwise fashion\n        for(int i = 0; i < acl; i++)\n            counterclockwise += distance[(destination + i) % n];\n        \n        // return minimum of clockwise and anti-clockwise distance\n        return Math.min(clockwise, counterclockwise);\n    }\n}\n```\n\n**Time Complexity: `O(n)`**\n**Space Complexity: `O(1)`**\n\n**Please `UPVOTE \uD83D\uDD3C` if like the code \uD83D\uDE04**\n
[]