Skip to content

Instantly share code, notes, and snippets.

@luojiyin1987
Created August 21, 2017 04:03
Show Gist options
  • Save luojiyin1987/7c8d150b4abec2ef9d347a20098f3b6e to your computer and use it in GitHub Desktop.
Save luojiyin1987/7c8d150b4abec2ef9d347a20098f3b6e to your computer and use it in GitHub Desktop.
Contains Duplicate
func containsDuplicate(nums []int) bool {
temp := make(map[int]int)
for _, v := range nums {
temp[v]++
if temp[v] >1 {
return true
}
}
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment