Skip to content

Commit 101b6e1

Browse files
dohee789dohee789
authored andcommitted
👔 contains-duplicate solution
1 parent 53ce7c7 commit 101b6e1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

contains-duplicate/dohee789.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
https://leetcode.com/problems/contains-duplicate/
3+
*/
4+
class Solution {
5+
public boolean containsDuplicate(int[] nums) {
6+
Set<Integer> set = new HashSet();
7+
for(int n: nums){
8+
if(set.contains(n)){
9+
return true;
10+
}
11+
set.add(n);
12+
}
13+
return false;
14+
}
15+
}

0 commit comments

Comments
 (0)