http://oj.leetcode.com/problems/implement-strstr/
判断一个串是否为另一个串的子串
比较简单的方法,复杂度为O(m*n),另外还可以用KMP时间复杂度为O(m+n),之前面试的时候遇到过。
class Solution { public: bool isEqual(char *a,char *b) { char* chPointer = a; char* chPointer2 = b; while(*chPointer2!= '
http://oj.leetcode.com/problems/implement-strstr/
判断一个串是否为另一个串的子串
比较简单的方法,复杂度为O(m*n),另外还可以用KMP时间复杂度为O(m+n),之前面试的时候遇到过。
class Solution { public: bool isEqual(char *a,char *b) { char* chPointer = a; char* chPointer2 = b; while(*chPointer2!= '