Exemplo n.º 1
0
        public void WordBreakSuccess()
        {
            string input = "leetcode";

            List <string> dict = new List <string>()
            {
                "leet",
                "code"
            };

            var result = new WordBreakSolution().WordBreak(input, dict);

            Assert.IsTrue(result);

            input = "catsandog";

            dict = new List <string>()
            {
                "cats",
                "dog",
                "and"
            };

            result = new WordBreakSolution().WordBreak(input, dict);
            Assert.IsFalse(result);
        }
Exemplo n.º 2
0
        private void Test(string word, ISet<string> dict, bool expectedResult)
        {
            WordBreakSolution wordBreak = new WordBreakSolution();
            bool result = wordBreak.WordBreak(word, dict);

            Assert.AreEqual(expectedResult, result);
        }
Exemplo n.º 3
0
        public void DynamicSolutionShouldReturnTrue()
        {
            var text = "leetcode";
            var dict = new List <string>()
            {
                "leet", "code"
            };


            var result = new WordBreakSolution().DynamicProgrammingSolution(text, dict);


            Assert.IsTrue(result);
        }