예제 #1
0
        public void Test2()
        {
            var sentances = new String[] { "abc", "abbc", "a" };
            var times     = new int[] { 3, 3, 3 };
            var solution  = new Datastructures._642.AutocompleteSystem(sentances, times);
            var list      = solution.input('b');
            var expected  = new string[] {  };

            Assert.Equal(expected, list);

            list     = solution.input('c');
            expected = new string[] {  };
            Assert.Equal(expected, list);

            list     = solution.input('#');
            expected = new string[] { };
            Assert.Equal(expected, list);

            list     = solution.input('a');
            expected = new string[] { "a", "abbc", "abc" };
            Assert.Equal(expected, list);
        }
예제 #2
0
        public void Test()
        {
            var sentances = new String[] { "i love you", "island", "iroman", "i love leetcode" };
            var times     = new int[] { 5, 3, 2, 2 };
            var solution  = new Datastructures._642.AutocompleteSystem(sentances, times);
            var list      = solution.input('i');
            var expected  = new string[] { "i love you", "island", "i love leetcode" };

            Assert.Equal(expected, list);

            list     = solution.input(' ');
            expected = new string[] { "i love you", "i love leetcode" };
            Assert.Equal(expected, list);

            list     = solution.input('a');
            expected = new string[] {  };
            Assert.Equal(expected, list);

            list     = solution.input('#');
            expected = new string[] { };
            Assert.Equal(expected, list);
        }