You are viewing a single comment's thread. Return to all comments →
I saw your gist you posted. Looks simple, but I came up with something I think is simpler.
int N = in.nextInt(); int sum = 0; int count = 0; for(int i=0; i < N; i++){ sum += in.nextInt(); if (sum % 2 == 1) { count += 2; } } System.out.println(sum % 2 == 0 ? count : "NO");
I don't like posting solutions but I like this one and the OP already posted a solution ;)
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 →
I saw your gist you posted. Looks simple, but I came up with something I think is simpler.
I don't like posting solutions but I like this one and the OP already posted a solution ;)