<awangdev>134. Gas Station_1.java
public int canCompleteCircuit(int[] gas, int[] cost) {
    	if (gas == null || cost == null || gas.length == 0 || cost.length == 0) {
    		return -1;
    	}
    	int startIndex = 0, remain = 0, total = 0;
    	for (int i = 0; i < gas.length; i++) {
			total += gas[i] - cost[i];
    		remain += gas[i] - cost[i];
    		if (remain < 0) {
    			remain = 0;
    			startIndex = i + 1; 
    		}
    	}
		return total < 0 ? -1 : startIndex;
    }
public int sample_funcname ( int [ ] var_0 , int [ ] var_1 ) {
  if ( var_0 == null || var_1 == null || var_0 . length == 0 || var_1 . length == 0 ) {
    return - 1 ;
  }
  int var_6 = 0 , var_7 = 0 , var_8 = 0 ;
  for ( int var_9 = 0 ;
  var_9 < var_0 . length ;
  var_9 ++ ) {
    var_8 += var_0 [ var_9 ] - var_1 [ var_9 ] ;
    var_7 += var_0 [ var_9 ] - var_1 [ var_9 ] ;
    if ( var_7 < 0 ) {
      var_7 = 0 ;
      var_6 = var_9 + 1 ;
    }
  }
  return var_8 < 0 ? - 1 : var_6 ;
}
