package leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * https://leetcode.com/problems/majority-element-ii/
 */
public class Problem229 {
    public List<Integer> majorityElement(int[] nums) {
        List<Integer> result = new ArrayList<>();
        // TODO
        return result;
    }

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

@@ -57,20 +57,68 @@
 va.util.
-List
+HashMap;%0Aimport java.util.List;%0Aimport java.util.Map
 ;%0A%0A/**%0A 
@@ -317,87 +317,325 @@
     
-// TODO%0A        return result;%0A    %7D%0A%0A    public static void main(String%5B%5D args
+Map%3CInteger, Integer%3E map = new HashMap%3C%3E();%0A        for (int num : nums) %7B%0A            if (map.containsKey(num)) %7B%0A                map.put(num, map.get(num)+1);%0A            %7D else %7B%0A                map.put(num, 1);%0A            %7D%0A        %7D%0A        map.forEach((num, count) -%3E %7B%0A            if (nums.length / 3 %3C count
 ) %7B%0A
@@ -646,42 +646,80 @@
     
+ 
-Problem229 prob = new Problem229()
+       result.add(num);%0A            %7D%0A        %7D);%0A        return result
 ;%0A  

Solve problem 229 (with O(n) space)