leetcode - 2019-05-01 16:32:44

https://leetcode-cn.com problems 重复 N 次的元素 - 力扣 (LeetCode) golang func repeatedNTimes(A []int) int { n := len(A)/2 result := make(map[int]int) for _, v := range A { val, ok := result[v] if ok { result[v] = val + 1 } else { result[v] = 1 } } for k,v := range result { if v == n { return k } } panic("error") } rust vec example: https://doc.