We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf37e31 commit c24003fCopy full SHA for c24003f
C++/implement-strstr.cpp
@@ -52,10 +52,6 @@ class Solution {
52
class Solution2 {
53
public:
54
int strStr(string haystack, string needle) {
55
- if (needle.empty()) {
56
- return 0;
57
- }
58
-
59
for (int i = 0; i + needle.length() < haystack.length() + 1; ++i) {
60
if (haystack.substr(i, needle.length()) == needle) {
61
return i;
0 commit comments