Created
May 11, 2024 02:20
-
-
Save ksamirdev/9d4dfc40204ffcc1eb56705ee1dec398 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func containsDuplicate(nums []int) bool { | |
m := make(map[int]bool, len(nums)) | |
for _, num := range nums { | |
if _, ok := m[num]; ok { | |
return true | |
} else { | |
m[num] = true | |
} | |
} | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment