@@ -0,0 +1,938 @@
+package easy;%0A%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A/**%0A * 217. Contains Duplicate QuestionEditorial Solution My Submissions Total Accepted: 106831 Total%0A * Submissions: 252115 Difficulty: Easy Given an array of integers, find if the array contains any%0A * duplicates. Your function should return true if any value appears at least twice in the array,%0A * and it should return false if every element is distinct.%0A */%0Apublic class ContainsDuplicate %7B%0A    public boolean containsDuplicate(int%5B%5D nums) %7B%0A        if(nums == null %7C%7C nums.length == 0) return false;%0A        Set%3CInteger%3E set = new HashSet();%0A        for(int i : nums)%7B%0A            if(!set.add(i)) return true;%0A        %7D%0A        return false;%0A    %7D%0A    %0A    public static void main(String...strings)%7B%0A        int%5B%5D nums = new int%5B%5D%7B1,2,3,4, 3%7D;%0A        ContainsDuplicate test = new ContainsDuplicate();%0A        System.out.println(test.containsDuplicate(nums));%0A    %7D%0A%7D%0A

contains duplicate