find-the-iV1.py (232B)
1 class Solution: 2 def strStr(self, haystack: str, needle: str) -> int: 3 for i in range(0, 1 + len(haystack) - len(needle)): 4 if haystack[i : i + len(needle)] == needle: 5 return i 6 return -1
leetcodeLeetcode submissions | |
| git clone git://git.laack.co/leetcode.git | |
| Log | Files | Refs | README |