• + 0 comments

    string fairRations(vector B) { string ans; int cnt=0; int n=B.size();

    for (int i=0;i<n;i++){
        if(i==n-1 && B[i]%2!=0){
            ans="NO";
            return ans;
    
    
        }
        if(B[i]%2!=0){
    
           B[i]++;
           B[i+1]++;
           cnt+=2;
    
        }
    }
    ans=to_string(cnt);
    return ans; ;
    

    }