We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53ce7c7 commit d8dff05Copy full SHA for d8dff05
contains-duplicate/sam.go
@@ -0,0 +1,17 @@
1
+// TC : O(n) : it iterates for the length of nums
2
+// SC : O(n) : hashmap is created with the size of nums
3
+
4
+func containsDuplicate(nums []int) bool {
5
+ hashmap := make(map[int]bool)
6
7
+ for i:=0;i<len(nums);i++ {
8
+ if hashmap[nums[i]] {
9
+ return true
10
+ }
11
12
+ hashmap[nums[i]] = true
13
14
15
+ return false
16
+}
17
0 commit comments