Simple java solution
class Solution {\n\n    public int distanceBetweenBusStops(int[] d, int s, int de) {\n        int i,j,k=0,h=0;\n        if(s>de)\n        {\n            for(i=s
class Solution {\n\n    public int distanceBetweenBusStops(int[] d, int s, int de) {\n        int i,j,k=0,h=0;\n        if(s>de)\n        {\n            for(i=s;i<d.length;i++)\n                k=k+d[i];\n            for(i=0;i<de;i++)\n            {\n                k=k+d[i];\n            }\n            for(j=s-1;j>=de;j--)\n            {\n                h=h+d[j];\n            }\n            System.out.print(k+" "+h);\n        }\n        else\n        {\n            for(i=s;i<de;i++)\n                k=k+d[i];\n            for(j=s-1;j>=0;j--)\n                h=h+d[j];\n            for(j=d.length-1;j>=de;j--)\n                h=h+d[j];      \n        }\n        return Math.min(k,h);\n    }\n}
[]