mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
13 lines
220 B
Go
13 lines
220 B
Go
package leetcode
|
|
|
|
func containsDuplicate(nums []int) bool {
|
|
record := make(map[int]bool, len(nums))
|
|
for _, n := range nums {
|
|
if _, found := record[n]; found {
|
|
return true
|
|
}
|
|
record[n] = true
|
|
}
|
|
return false
|
|
}
|