@@ -0,0 +1,664 @@
+// https://community.topcoder.com/stat?c=problem_statement&pm=11800%0A%0Apublic class BinaryPolynomialDivTwo %7B%0A%09public static int countRoots(int%5B%5D a) %7B%0A%09%09int P0 = a%5B0%5D; // 0%5E0 = 1 (according to problem statement)%0A%09%09int P1 = a%5B0%5D; %0A%09%09%0A%09%09for (int i = 1; i %3C a.length; ++i) %7B%0A%09%09%09P1 += a%5Bi%5D; %0A%09%09%09// NOTE 1: no need to add to P(0), as we're always multiplying a%5Bi%5D by 0, since 0%5E1 = 0, 0%5E2 = 0 etc.%0A%09%09%09// NOTE 2: also no need to write explicitly that in P(1) we multiply a%5Bi%5D by 1, since 1%5E1 = 1, 1%5E2 = 1 etc.%0A%09%09%7D%0A%09%0A%09%09// Get number of roots%0A%09%09int rootCount = 0;%0A%0A%09%09if (P0 %25 2 == 0) %7B%0A%09%09%09rootCount++;%0A%09%09%7D%0A%09%09if (P1 %25 2 == 0) %7B%0A%09%09%09rootCount++;%0A%09%09%7D%0A%09%09%0A%09%09return rootCount;%0A%09%7D%0A%7D%0A

Create BinaryPolynomialDivTwo.java