Skip to content

Commit

Permalink
contains-duplicate solution
Browse files Browse the repository at this point in the history
  • Loading branch information
hancrysta1 committed Dec 14, 2024
1 parent 5acf128 commit 19f6205
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions contains-duplicate/sj.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import java.util.*;
class Solution {
public boolean containsDuplicate(int[] nums) {
Set<Integer> numSet = Arrays.stream(nums).boxed().collect(Collectors.toSet());
if(numSet.size()!=nums.length) return true;
else return false;
}
}

0 comments on commit 19f6205

Please sign in to comment.