public int canCompleteCircuit(int[] gas, int[] cost) {
		 if(gas.length==1) return gas[0]>=cost[0]?0:-1; 
		 this.gas = gas;
		 this.cost = cost;
		 N =  gas.length;
		 int i = 0;
		 int c= 0;
		 while(c<N)
		 {
			 remain = 0;
			 first = true;
			 int temp = T(i,i);
			 if(!first && temp==i) return i;
			 if(temp<i) break;
			 if(first) c+=1;
			 else c+=temp-i+1;
			 i = temp+1;
		 }
		 return -1;
	}