@@ -0,0 +1,819 @@
+package leetcode.gas_station;%0A%0A%0Apublic class Solution %7B%0A%09public int canCompleteCircuit(int%5B%5D gas, int%5B%5D cost) %7B%0A%09%09if (gas.length == 0)%0A%09%09%09return -1;%0A%09%09int N = gas.length;%0A%09%09int min = 0, mini = 0;%0A%09%09int cur = 0;%0A%09%09for(int i = 0; i %3C N; i++)%7B%0A%09%09%09if(cur %3C min)%7B%0A%09%09%09%09min = cur;%0A%09%09%09%09mini = i;%0A%09%09%09%7D%0A%09%09%09int remain = cur + gas%5Bi%5D - cost%5Bi%5D;%0A%09%09%09cur = remain;%0A%09%09%7D%0A%09%09if(cur %3C 0) return -1;%0A%09%09return mini;%0A%09%7D%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09int%5B%5D gas = new int%5B10000%5D; // 3897~10000, 1~3896%0A%09%09int%5B%5D cost = new int%5B10000%5D; //3311~10000, 1~3310%0A%09%09for(int i = 0; i %3C 10000; i++)%7B%0A%09%09%09gas%5Bi%5D = (3896 + i) %25 10000 + 1;%0A%09%09%09cost%5Bi%5D = (3310 + i) %25 10000 + 1;%0A%09%09%7D%0A%09%09System.err.println(new Solution().canCompleteCircuit(gas, cost));%0A%09%09System.err.println(new Solution().canCompleteCircuit(new int%5B%5D%7B1, 2%7D, new int%5B%5D%7B2, 1%7D));%0A%09%7D%0A%7D%0A

Add java solution for 134. Gas Station