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 177823b commit 0b9737dCopy full SHA for 0b9737d
problems/0028.实现strStr.md
@@ -685,7 +685,21 @@ class Solution {
685
```
686
687
Python3:
688
-
+```python
689
+//暴力解法:
690
+class Solution(object):
691
+ def strStr(self, haystack, needle):
692
+ """
693
+ :type haystack: str
694
+ :type needle: str
695
+ :rtype: int
696
697
+ m,n=len(haystack),len(needle)
698
+ for i in range(m):
699
+ if haystack[i:i+n]==needle:
700
+ return i
701
+ return -1
702
+```
703
```python
704
// 方法一
705
class Solution:
0 commit comments