You are viewing a single comment's thread. Return to all comments →
C# Solution
public static string fairRations(List<int> B) { int loavesDistributed = 0; for(int i = 0; i < B.Count - 1; i++) { if(B[i] % 2 == 1) { B[i + 1]++; loavesDistributed += 2; } } return B[B.Count - 1] % 2 == 1 ? "NO" : Convert.ToString(loavesDistributed); }
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 →
C# Solution