mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-08-05 21:20:59 +08:00
13 lines
192 B
Go
13 lines
192 B
Go
package leetcode
|
|
|
|
func repeatedNTimes(A []int) int {
|
|
kv := make(map[int]struct{})
|
|
for _, val := range A {
|
|
if _, ok := kv[val]; ok {
|
|
return val
|
|
}
|
|
kv[val] = struct{}{}
|
|
}
|
|
return 0
|
|
}
|