Exemplo n.º 1
0
        public void ThreeSum_Test1()
        {
            var sut      = new Solution();
            var input    = new int[] { 3, -2, 1, 0 };
            var expected = new List <IList <int> >
            {
            };

            var actual = sut.ThreeSum(input);

            AssertTwoDementionalLists.AreMatch(expected, (List <IList <int> >)actual);
        }
Exemplo n.º 2
0
        public void Example3_Can_solve_if_only_one_letter_in_array()
        {
            var input    = new string[] { "a" };
            var expected = new List <IList <string> >()
            {
                new List <string>()
                {
                    "a"
                }
            };
            var sut = new Solution();

            var actual = sut.GroupAnagrams(input);

            AssertTwoDementionalLists.AreMatch(expected, actual);
        }
Exemplo n.º 3
0
        public void Example2_Empty_string_returns_empty_list_nested_in_list()
        {
            var input    = new string[] { "" };
            var expected = new List <IList <string> >()
            {
                new List <string>()
                {
                    ""
                }
            };
            var sut = new Solution();

            var actual = sut.GroupAnagrams(input);

            AssertTwoDementionalLists.AreMatch(expected, actual);
        }
Exemplo n.º 4
0
        public void ThreeSum_Example1()
        {
            var sut      = new Solution();
            var input    = new int[] { -1, 0, 1, 2, -1, -4 };
            var expected = new List <IList <int> >
            {
                new List <int> {
                    -1, -1, 2
                },
                new List <int> {
                    -1, 0, 1
                },
            };

            var actual = sut.ThreeSum(input);

            AssertTwoDementionalLists.AreMatch(expected, (List <IList <int> >)actual);
        }
Exemplo n.º 5
0
        public void Example1_Can_group_anagrams()
        {
            var input    = new string[] { "eat", "tea", "tan", "ate", "nat", "bat" };
            var expected = new List <IList <string> >()
            {
                new List <string>()
                {
                    "bat"
                },
                new List <string>()
                {
                    "nat", "tan"
                },
                new List <string>()
                {
                    "ate", "eat", "tea"
                }
            };
            var sut = new Solution();

            var actual = sut.GroupAnagrams(input);

            AssertTwoDementionalLists.AreMatch(expected, actual);
        }