Contains Duplicate
ID: 217; easy
Last updated
Was this helpful?
Was this helpful?
func containsDuplicate(nums []int) bool {
m := make(map[int]bool, len(nums))
for _, n := range nums {
if _, found := m[n]; found {
return true
}
m[n] = true
}
return false
}