https://leetcode.com/problems/majority-element-ii


Runtime: 12 ms, faster than 54.41% of Go online submissions for Majority Element II.
Memory Usage: 5.1 MB, less than 52.94% of Go online submissions for Majority Element II.


```go
func majorityElement(nums []int) []int {
	//1:56
	counter := make(map[int]int)
	for _, num := range nums {
		_, ok := counter[num]
		if !ok {
			counter[num] = 1
		} else {
			counter[num] += 1
		}
	}

	results := make([]int, 0)
	threshold := int(len(nums) / 3)
	for num, counting := range counter {
		if counting > threshold {
			results = append(results, num)
		}
	}

	return results
	//2:02
}
```