예제 #1
0
        public void NullArray_Success()
        {
            int[] arr    = null;
            var   sol    = new ContainDuplicates(arr);
            var   result = sol.GetContainDuplicatesWithHash();

            Assert.False(result);
        }
예제 #2
0
        public void ManyItemsArray_Success_True()
        {
            int[] arr    = { 1, 1, 1, 3, 3, 4, 3, 2, 4, 2 };
            var   sol    = new ContainDuplicates(arr);
            var   result = sol.GetContainDuplicatesWithHash();

            Assert.True(result);
        }
예제 #3
0
        public void FourthItemsArray_Success_True()
        {
            int[] arr    = { 1, 2, 3, 1 };
            var   sol    = new ContainDuplicates(arr);
            var   result = sol.GetContainDuplicatesWithHash();

            Assert.True(result);
        }
예제 #4
0
        public void UniqueItemsArray_Success_False()
        {
            int[] arr    = { 1, 2, 3, 4 };
            var   sol    = new ContainDuplicates(arr);
            var   result = sol.GetContainDuplicatesWithHash();

            Assert.False(result);
        }
예제 #5
0
        public bool ContainsDuplicate(int[] nums)
        {
            var sol = new ContainDuplicates(nums);

            return(sol.GetContainDuplicatesWithHash());
        }