Skip to content

Commit

Permalink
test: write test ContainsDuplicate using hash set
Browse files Browse the repository at this point in the history
  • Loading branch information
rldnrl committed Nov 19, 2022
1 parent c6ad26d commit 519dbc8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/leetcode/ContainsDuplicateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,16 @@ void containDuplicate() {
int[] nums3 = new int[]{1,1,1,3,3,4,3,2,4,2};
Assertions.assertTrue(ContainsDuplicate.containsDuplicate(nums3));
}

@Test
void containDuplicateWithHashSet() {
int[] nums1 = new int[]{1,2,3,1};
Assertions.assertTrue(ContainsDuplicate.containsDuplicateWithHashSet(nums1));

int[] nums2 = new int[]{1,2,3};
Assertions.assertFalse(ContainsDuplicate.containsDuplicateWithHashSet(nums2));

int[] nums3 = new int[]{1,1,1,3,3,4,3,2,4,2};
Assertions.assertTrue(ContainsDuplicate.containsDuplicateWithHashSet(nums3));
}
}

0 comments on commit 519dbc8

Please sign in to comment.