@@ -0,0 +1,894 @@
+/***%0A * There are N gas stations along a circular route, where the amount of gas at station i is gas%5Bi%5D.%0A *%0A * You have a car with an unlimited gas tank and it costs cost%5Bi%5D of gas to travel from station i to its next station (i+1). You begin the journey with an empty tank at one of the gas stations.%0A *%0A * Return the starting gas station's index if you can travel around the circuit once, otherwise return -1.%0A *%0A * Note:%0A * The solution is guaranteed to be unique.%0A */%0Apublic class Solution %7B%0A    public int canCompleteCircuit(int%5B%5D gas, int%5B%5D cost) %7B%0A        int n = gas.length;%0A        int total = 0;%0A        int j = -1;%0A        for (int i = 0, sum = 0; i %3C n; i++) %7B%0A            sum += gas%5Bi%5D - cost%5Bi%5D;%0A            total += gas%5Bi%5D - cost%5Bi%5D;%0A            if (sum %3C 0) %7B%0A                j = i;%0A                sum = 0;%0A            %7D%0A        %7D%0A        return total %3E= 0? j + 1 : -1;%0A   %7D%0A%7D%0A

add GasStation.java