@@ -0,0 +1,2550 @@
+//https://www.hackerrank.com/contests/projecteuler/challenges/euler008%0Aimport java.io.*;%0A%0Apublic class Solution %7B%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        StringBuffer sb = new StringBuffer();%0A        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));%0A        %0A        //For each test case%0A        for(byte T = Byte.parseByte(br.readLine()); T %3E 0; --T)%7B%0A            %0A            //Get input%0A            String%5B%5D line = br.readLine().split(%22 %22);%0A            final short N = Short.parseShort(line%5B0%5D);%0A            final byte K = Byte.parseByte(line%5B1%5D);%0A            final byte%5B%5D A = toByteArray(br.readLine().toCharArray());%0A            %0A            //Initialize 'product' to product of first K values%0A            //Do not multiply by zero but keep track of how many encountered%0A            int product = 1;%0A            short numZeros = 0;%0A            int maxProduct = 0;%0A            for(short i = 0; i %3C K; ++i)%7B%0A                if(A%5Bi%5D == 0)%7B%0A                    ++numZeros;%0A                %7D else %7B%0A                    product *= A%5Bi%5D;%0A                %7D%0A            %7D%0A            %0A            //If the product is valid (there are no zeros in it), it's our current max product%0A            if(numZeros %3C 1)%7B%0A                maxProduct = product;%0A            %7D%0A            %0A            //Go through the remainder of A...%0A            for(short i = K; i %3C N; ++i)%7B%0A                final short j = (short)(i-K);%0A                %0A                //Divide from product the value now outside the current subset%0A                if(A%5Bj%5D == 0)%7B%0A                    --numZeros;%0A                %7D else %7B%0A                    product /= A%5Bj%5D;%0A                %7D%0A                %0A                //Multiply into product the value now inside the current subset%0A                if(A%5Bi%5D == 0)%7B%0A                    ++numZeros;%0A                %7D else %7B%0A                    product *= A%5Bi%5D;%0A                %7D%0A                %0A                //Update maxProduct if the current product is valid and the biggest so far%0A                if(product %3E maxProduct && numZeros %3C 1)%7B%0A                    maxProduct = product;%0A                %7D%0A            %7D%0A            %0A            //Print output%0A            sb.append(maxProduct + %22%5Cn%22);%0A        %7D%0A        System.out.print(sb);%0A    %7D%0A    %0A    private static byte%5B%5D toByteArray(final char%5B%5D A)%7B%0A        final int N = A.length;%0A        final byte%5B%5D B = new byte%5BN%5D;%0A        for(int i = 0; i %3C N; ++i)%7B%0A            B%5Bi%5D = (byte)(A%5Bi%5D - '0');%0A        %7D%0A        return B;%0A    %7D%0A%7D%0A

Create euler008.java