Example #1
0
        public void RunProblem()
        {
            var temp = FindSmallestSetOfVertices(6, new List <IList <int> >()
            {
                new List <int>()
                {
                    0, 1
                },
                new List <int>()
                {
                    0, 2
                },
                new List <int>()
                {
                    2, 5
                },
                new List <int>()
                {
                    3, 4
                },
                new List <int>()
                {
                    4, 2
                },
            });

            if (ProblemHelper.ArrayEqual(new[] { 0, 3 }, temp))
            {
                throw new Exception();
            }
        }
Example #2
0
        public void RunProblem()
        {
            var temp = MaxSlidingWindow(new[] { 1, 3, -1, -3, 5, 3, 6, 7 }, 3);

            if (!ProblemHelper.ArrayEqual(temp, new[] { 3, 3, 5, 5, 6, 7 }))
            {
                throw new Exception();
            }

            temp = MaxSlidingWindow(new[] { 7, 2, 4 }, 2);
            if (!ProblemHelper.ArrayEqual(temp, new[] { 7, 4 }))
            {
                throw new Exception();
            }
        }
        private void ArrayEqualTest()
        {
            var a1 = new[] { 1, 2, 3, 4 };
            var a2 = new[] { 3, 4, 1, 2 };

            var temp = ProblemHelper.ArrayEqual(a1, a2);

            var b1 = new List <int>()
            {
                '1', '2', '4', '6'
            };
            var b2 = new List <int>()
            {
                '1', '2', '4', '6'
            };

            temp = ProblemHelper.ArrayEqual(b1, b2, false);

            var c1 = new[] { 'a', 'b', 'c' };
            var c2 = new[] { 'b', 'a', 'c' };

            temp = ProblemHelper.ArrayEqual(c1, c2, false);
            temp = ProblemHelper.ArrayEqual(c1, c2);
        }