You are viewing a single comment's thread. Return to all comments →
C#, should be equivalent:
static int fairRations(int[] B) { int c = 0; for (int i = 1; i < B.Length; i++) { if (B[i - 1] % 2 != 0) { B[i - 1]++; B[i]++; c += 2; } if (B[i - 1] % 2 != 0) return -1; } if (B[B.Length - 1] % 2 != 0) return -1;//edge return c; }
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#, should be equivalent: