@@ -0,0 +1,617 @@
+package leetcode;%0A%0A/**%0A * https://leetcode.com/problems/distance-between-bus-stops/%0A */%0Apublic class Problem1184 %7B%0A    public int distanceBetweenBusStops(int%5B%5D distance, int start, int destination) %7B%0A        int%5B%5D sums = new int%5Bdistance.length%5D;%0A        int totalSum = distance%5B0%5D;%0A        for (int i = 1; i %3C distance.length; i++) %7B%0A            sums%5Bi%5D = distance%5Bi - 1%5D + sums%5Bi - 1%5D;%0A            totalSum += distance%5Bi%5D;%0A        %7D%0A        int val1 = sums%5BInteger.max(start, destination)%5D - sums%5BInteger.min(start, destination)%5D;%0A        int val2 = totalSum - val1;%0A        return Integer.min(val1, val2);%0A    %7D%0A%7D%0A

Solve problem 1184