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