Beispiel #1
0
        public void NullOrEmptyArray_Success()
        {
            int[] arr    = null;
            int   k      = 0;
            var   sol    = new ContainsDuplicates2(arr, k);
            var   result = sol.IsThereDuplicates();

            Assert.False(result);
        }
Beispiel #2
0
        public void SecondArray_Success()
        {
            int[] arr    = { 1, 0, 1, 1 };
            int   k      = 1;
            var   sol    = new ContainsDuplicates2(arr, k);
            var   result = sol.IsThereDuplicates();

            Assert.True(result);
        }
Beispiel #3
0
        public void ThirdArray_Success()
        {
            int[] arr    = { 1, 2, 3, 1, 2, 3 };
            int   k      = 2;
            var   sol    = new ContainsDuplicates2(arr, k);
            var   result = sol.IsThereDuplicates();

            Assert.False(result);
        }
Beispiel #4
0
        public void FirstArray_Success()
        {
            int[] arr    = { 1, 2, 3, 1 };
            int   k      = 3;
            var   sol    = new ContainsDuplicates2(arr, k);
            var   result = sol.IsThereDuplicates();

            Assert.True(result);
        }