Greedy Algorithms - Gas Station (Circular)
Consider the following buggy code snippet for the Gas Station problem:
```python
def canCompleteCircuit(gas, cost):
if sum(gas) < sum(cost):
return -1
start = 0
tank = 0
for i in range(len(gas)):
tank += gas[i] - cost[i]
if tank < 0:
start = i
tank = 0
return start
```
What is the subtle bug causing incorrect results on some inputs?
