@@ -0,0 +1,946 @@
+/**%0A * @fileName: ContainsDuplicate.java%0A * @author: Akhash Ramamurthy%0A * @CreatedOn: Jun 23, 2019%0A * %0A */%0Apackage com.akh.algorithms.leetcode.easy.lc217;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport java.util.Arrays;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * @fileName: ContainsDuplicate.java%0A * @author: Akhash Ramamurthy%0A * @Created on: Jun 23, 2019%0A * %0A */%0Apublic class ContainsDuplicate %7B%0A%0A%09public boolean containsDuplicate(int%5B%5D nums) %7B%0A%09%09int len = nums.length;%0A%09%09if (len %3C 2)%0A%09%09%09return false;%0A%09%09%0A%09%09Arrays.sort(nums);%0A%09%09int i = 1;%0A%09%09while(i %3C len) %7B%0A%09%09%09if (nums%5Bi-1%5D == nums%5Bi%5D)%0A%09%09%09%09return true;%0A%09%09%09i++;%0A%09%09%7D%0A%09%09return false;%0A%09%7D%0A%09%0A%09@Test%0A%09public void Test_101() %7B%0A%09%09int%5B%5D nums = new int%5B%5D%7B1,2,3,1%7D;%0A%09%09boolean expected = true;%0A%09%09assertEquals(expected, containsDuplicate(nums));%0A%09%7D%0A%09%0A%09@Test%0A%09public void Test_102() %7B%0A%09%09int%5B%5D nums = new int%5B%5D%7B1,2,3,4,5,6,7,8%7D;%0A%09%09boolean expected = false;%0A%09%09assertEquals(expected, containsDuplicate(nums));%0A%09%7D%0A%0A%7D%0A

Find if a int array contains duplicate