You are viewing a single comment's thread. Return to all 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; ;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Fair Rations
You are viewing a single comment's thread. Return to all comments →
string fairRations(vector B) { string ans; int cnt=0; int n=B.size();
}