public void Test_Generic(string[] dict, string[] words, bool[] expected) { var sol = new MagicDictionary(); sol.BuildDict(dict); for (int i = 0; i < words.Length; i++) { Assert.AreEqual(sol.Search(words[i]), expected[i]); } }
static void Main(string[] args) { var dict = new MagicDictionary(); string[] dictionary = { "hello", "leetcode" }; dict.BuildDict(dictionary); //Console.WriteLine(dict.Search("hello")); Console.WriteLine(dict.Search("hhllo")); Console.WriteLine(dict.Search("hell")); Console.WriteLine(dict.Search("leetcoded")); }