@@ -0,0 +1,1591 @@
+public class Solution %7B%0A    public static IntPair PairyTime(int k, int%5B%5D A) %7B%0A        int%5B%5D found = new int%5Bk+1%5D;%0A        for (int i = 0; i %3C k+1; i++) %7B%0A            found%5Bi%5D = -1;%0A        %7D%0A        %0A        for (int i = 0; i %3C A.length; i++) %7B%0A            // the modulus operator computes the remainder, which%0A            // isn't what we want here (it does the wrong thing with%0A            // negative numbers). the difference is that we want the%0A            // division to round _towards zero_, not down.%0A            int a = Math.floorMod(A%5Bi%5D, k);%0A            if (found%5Bk-a%5D != -1) %7B%0A                return new IntPair(found%5Bk-a%5D, i);%0A            %7D%0A            found%5Ba%5D = i;%0A%0A            // if we find another a that's equal to zero, found%5Bk-a%5D%0A            // will not be filled as it should be in unless we also do this%0A            if (a == 0) %7B%0A                found%5Bk%5D = i;%0A            %7D%0A        %7D%0A%0A        return null;%0A    %7D%0A    %0A    public static void main(String%5B%5D args) %7B%0A        System.out.println(PairyTime(3, new int%5B%5D%7B-2, 2%7D));%0A        System.out.println(PairyTime(8, new int%5B%5D%7B1, -2, -9, 1, 1, 1%7D));%0A        System.out.println(PairyTime(7, new int%5B%5D%7B0, 3, 1, 1, 0%7D));%0A        System.out.println(PairyTime(4, new int%5B%5D%7B%7D));%0A        System.out.println(PairyTime(3, new int%5B%5D%7B1, 1%7D));%0A    %7D%0A%0A    private static class IntPair %7B%0A        public int fst;%0A        public int snd;%0A        %0A        public IntPair(int f, int s) %7B%0A            fst = f;%0A            snd = s;%0A        %7D%0A%0A        public String toString() %7B%0A            return %22%5B%22 + fst + %22, %22 + snd + %22%5D%22;%0A        %7D%0A    %7D%0A%7D%0A

Solve question 19 in java