Пример #1
0
        public void Try_mississippi_sippia_SolutionOne_Succeed()
        {
            var str    = new StrStr("mississippi", "sippia");
            var result = str.SolutionOne();

            Assert.AreEqual(-1, result);
        }
Пример #2
0
        public void Try_aaa_aaaa_SolutionOne_Succeed()
        {
            var str    = new StrStr("aaa", "aaaa");
            var result = str.SolutionOne();


            Assert.AreEqual(-1, result);
        }
Пример #3
0
        public void Try_hello_SolutionOne_Succeed()
        {
            var str    = new StrStr("hello", "ll");
            var result = str.SolutionOne();


            Assert.AreEqual(2, result);
        }
Пример #4
0
        public void Try_EmptyHayStackAndNeedle_SolutionOne_Succeed()
        {
            var str    = new StrStr("", "");
            var result = str.SolutionOne();


            Assert.AreEqual(0, result);
        }
Пример #5
0
        public void Try_abracadabra_SolutionOne_Succeed()
        {
            var str    = new StrStr("abracadabra", "abra");
            var result = str.SolutionOne();


            Assert.AreEqual(0, result);
        }
Пример #6
0
        public void Try_AABRAACADABRAACAADABRA_AACAA_SolutionKMP_Succeed()
        {
            var str    = new StrStr("AABRAACADABRAACAADABRA", "AACAA");
            var result = str.SolutionKMP();


            Assert.AreEqual(13, result);
        }
Пример #7
0
 public int StrStr(string haystack, string needle)
 {
     var sol = new StrStr(haystack,needle);
     return sol.SolutionOne();
 }