Report problem solving - find substring

Ideas algorithm:

1. calculate the length of the string s and t with the substring function;

2. Application of the string s cycle, a one character is determined whether the same starting from the back of a few characters are characters and character substring t, K is calculated the same number of characters;

3. determining whether k is equal to the same number of sub-length string of characters of t.

 

Problems and solutions encountered:

Analyzing the relationship with tlen k. If at the end of t, the '\ 0' character s character array is also referred to as the same characters, k TLEN large than 1, so k> = tlen.

Core code:

 

Guess you like

Origin www.cnblogs.com/huangdongyang666/p/12051615.html