标签:imp 实现 ems ble strstr http stack tac als
class Solution {
public:
int strStr(string haystack, string needle) {
int n = haystack.size();
int m = needle.size();
for (int i = 0; i < n - m + 1; ++i) {
bool flag = true;
for (int j = 0; j < m; ++j) {
if (haystack[i + j] != needle[j]) {
flag = false;
break;
}
}
if (flag) {
return i;
}
}
return -1;
}
};
标签:imp 实现 ems ble strstr http stack tac als
原文地址:https://www.cnblogs.com/clown9804/p/13168855.html