Skip to content

Commit 39be389

Browse files
committed
contains duplicate solution
1 parent c8505f9 commit 39be389

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

contains-duplicate/eunhwa99.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
public boolean containsDuplicate(int[] nums) {
3+
HashSet<Integer> seen = new HashSet<>();
4+
for (int num : nums) {
5+
if (!seen.add(num)) {
6+
return true;
7+
}
8+
}
9+
10+
return false;
11+
12+
13+
}
14+
}

0 commit comments

Comments
 (0)