#### Gas Station(LeetCode)

There are N gas stations along a circular route, where the amount of gas at station i is gas[i].

You have a car with an unlimited gas tank and it costs cost[i] 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.

Return the starting gas station’s index if you can travel around the circuit once, otherwise return -1.

Note: The solution is guaranteed to be unique.

class Solution:
# @param gas, a list of integers
# @param cost, a list of integers
# @return an integer
def canCompleteCircuit(self, gas, cost):
N = len(gas)
if N==1:
if gas[0]>=cost[0]:
return 0
else:
return -1
if sum(gas)<sum(cost):
return -1
i=0
while i<N:
flag = True
num = 0
for j in xrange(N):
num += gas[(i+j)%N]
if num<cost[(i+j)%N]:
flag = False
i = (i+j)%N+1
break
num -= cost[(i+j)%N]
if flag:
return i
return -1