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 a3d7b57Copy full SHA for a3d7b57
contains-duplicate/leebeanbin.java
@@ -0,0 +1,18 @@
1
+import java.util.HashSet;
2
+
3
+class Solution {
4
+ public boolean containsDuplicate(int[] nums) {
5
+ HashSet<Integer> arr = new HashSet<Integer>();
6
+ boolean answer = false;
7
8
+ for(int num : nums){
9
+ arr.add(num);
10
+ }
11
12
+ if(nums.length != arr.size()){
13
+ answer = true;
14
15
16
+ return answer;
17
18
+}
0 commit comments