What's wrong in this code, getting wrong answer


#1

int Solution::canCompleteCircuit(const vector &a, const vector &b) {
vectorc(a.size());
for(int i=0; i<a.size(); i++)c[i]=a[i]-b[i];
for(int i=1; i<c.size(); i++)c[i]+=c[i-1];
if(c.back()<0)return -1;
int i;
for(i = c.size()-2; i>=0; i–)if(c[i]<0)break;
return i+1;
}