import java.util.ArrayList;

/**
 * Problem: #217 Contains Duplicate
 *
 * Idea:
 *
 * Solutions:
 *  singleNumberHash: using a hash map to store unique characters found.
 *  singleNumber:
 *
 * Note: #canbefaster
 */
public class ContainsDuplicate {
    public boolean containsDuplicate(int[] nums) {
        ArrayList<Integer> list = new ArrayList<>();
        for (int num : nums) {
            if (list.contains(num)) return true;
            list.add(num);
        }
        return false;
    }
}

@@ -15,19 +15,64 @@
 il.Array
-Lis
+s;%0Aimport java.util.HashSet;%0Aimport java.util.Se
 t;%0A%0A/**%0A
@@ -140,28 +140,33 @@
 ns:%0A *  
-singleNumber
+containsDuplicate
 Hash: us
@@ -180,11 +180,11 @@
 ash 
-map
+set
  to 
@@ -222,46 +222,78 @@
  *  
-singleNumber:%0A *%0A * Note: #canbefaster
+containsDuplicateSort: sort then find. This exceeds the time limit.%0A *
 %0A */
@@ -362,16 +362,20 @@
 uplicate
+Hash
 (int%5B%5D n
@@ -389,24 +389,18 @@
         
-ArrayLis
+Se
 t%3CIntege
@@ -406,19 +406,18 @@
 er%3E 
-li
 s
+e
 t = new 
 Arra
@@ -416,16 +416,14 @@
 new 
-ArrayLis
+HashSe
 t%3C%3E(
@@ -472,19 +472,18 @@
     if (
-li
 s
+e
 t.contai
@@ -520,11 +520,10 @@
     
-li
 s
+e
 t.ad
@@ -567,11 +567,235 @@
 e;%0A    %7D
+%0A%0A    public boolean containsDuplicateSort(int%5B%5D nums) %7B%0A        Arrays.sort(nums);%0A        for (int i = 0; i %3C nums.length - 1; i++) %7B%0A            if (nums%5Bi%5D == nums%5Bi+1%5D) return true;%0A        %7D%0A        return false;%0A    %7D
 %0A%7D%0A

Add new solution