package leetcode;

/**
 * https://leetcode.com/problems/n-repeated-element-in-size-2n-array/
 */
public class Problem961 {
    public int repeatedNTimes(int[] A) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem961 prob = new Problem961();
    }
}

@@ -12,16 +12,65 @@
 tcode;%0A%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A%0A
 /**%0A * h
@@ -218,128 +218,429 @@
     
-// TODO%0A        return 0
+int n = A.length / 2;%0A        Map%3CInteger, Integer%3E map = new HashMap%3C%3E()
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem961 prob = new Problem961()
+int answer = 0;%0A        for (int a : A) %7B%0A            if (!map.containsKey(a)) %7B%0A                map.put(a, 1);%0A            %7D else %7B%0A                map.put(a, map.get(a) + 1);%0A                if (map.get(a) == n) %7B%0A                    answer = a;%0A                    break;%0A                %7D%0A            %7D%0A        %7D%0A        return answer
 ;%0A  

Solve problem 961