Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions contains-duplicate/SamTheKorean.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// TC : O(n) : it iterates for the length of nums
// SC : O(n) : hashmap is created with the size of nums

func containsDuplicate(nums []int) bool {
hashmap := make(map[int]bool)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해시맵을 사용해서 풀이한게 인상적이네요.


for i:=0;i<len(nums);i++ {
if hashmap[nums[i]] {
return true
}

hashmap[nums[i]] = true
}

return false
}