package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/missing-numbers
 */
public class MissingNumbers {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // TODO
    }
}

@@ -31,23 +31,97 @@
 va.util.
-Scanner
+HashMap;%0Aimport java.util.Map;%0Aimport java.util.Scanner;%0Aimport java.util.TreeSet
 ;%0A%0A/**%0A 
@@ -219,108 +219,1402 @@
    p
-ublic static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A        // TODO
+rivate static void missingNumbers(Map%3CInteger, Integer%3E mapA, Map%3CInteger, Integer%3E mapB) %7B%0A        TreeSet%3CInteger%3E set = new TreeSet%3C%3E();%0A        for (Map.Entry%3CInteger, Integer%3E entryB : mapB.entrySet()) %7B%0A            if (!mapA.containsKey(entryB.getKey())) %7B%0A                set.add(entryB.getKey());%0A            %7D else %7B%0A                int countA = mapA.get(entryB.getKey());%0A                if (countA != entryB.getValue()) %7B%0A                    set.add(entryB.getKey());%0A                %7D%0A            %7D%0A        %7D%0A        set.forEach(e -%3E System.out.print(e + %22 %22));%0A        System.out.println();%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A        int n = in.nextInt();%0A        Map%3CInteger, Integer%3E mapA = new HashMap%3C%3E();%0A        for (int i = 0; i %3C n; i++) %7B%0A            int val = in.nextInt();%0A            if (!mapA.containsKey(val)) %7B%0A                mapA.put(val, 1);%0A            %7D else %7B%0A                mapA.put(val, mapA.get(val) + 1);%0A            %7D%0A        %7D%0A        int m = in.nextInt();%0A        Map%3CInteger, Integer%3E mapB = new HashMap%3C%3E();%0A        for (int i = 0; i %3C m; i++) %7B%0A            int val = in.nextInt();%0A            if (!mapB.containsKey(val)) %7B%0A                mapB.put(val, 1);%0A            %7D else %7B%0A                mapB.put(val, mapB.get(val) + 1);%0A            %7D%0A        %7D%0A        missingNumbers(mapA, mapB);
 %0A   

Solve Missing Numbers