From c3ffc0ea5e47f1e57758a241e8dac0a70adfc497 Mon Sep 17 00:00:00 2001 From: shaikseemaa94 Date: Thu, 9 Dec 2021 21:32:38 -0500 Subject: [PATCH] Create ContainsDuplicateTest.java --- company/palantir/ContainsDuplicateTest.java | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 company/palantir/ContainsDuplicateTest.java diff --git a/company/palantir/ContainsDuplicateTest.java b/company/palantir/ContainsDuplicateTest.java new file mode 100644 index 00000000..e74f53c9 --- /dev/null +++ b/company/palantir/ContainsDuplicateTest.java @@ -0,0 +1,26 @@ +import static org.junit.Assert.assertEquals; +import org.junit.Test; + + +//Given an array of integers, find if the array contains any duplicates. Your function should return +//true if any value appears at least twice in the array, and it should return false if every element is distinct. + +public class ContainsDuplicateTest { + + @Test + void Example1() { + int[] arr = {1,1,3,4}; + assertTrue(containsDuplicate(arr)); + } + @Test + void Example2() { + int[] arr = {1,3,4}; + assertFalse(containsDuplicate(arr)); + } + @Test + void Example3() { + int[] arr = {1,1,2,2}; + assertFalse(containsDuplicate(arr)); + } + +}