public static int canCompleteCircuit(int[] gas, int[] cost) {//naive, TLE
        //the result is guaranteed to be unique
    	//for those problem with "circular", we can gracefully solve it by doubling the length
    	int len = gas.length;
    	for (int i = 0; i < len; ++i) {
    		int total_gas = 0;
    		
    		for (int j = i; j <= len + i; ++j) {
    			if (j == len+i) return i;
    			total_gas += gas[j%len];
    			if (total_gas < (cost[j%len])) {
    				break;
    			}
    			else {
    				total_gas -= (cost[j%len]);
    			}
    			
    		}
    	}
    	return -1;
    }