HTMLify
find-the-index-of-the-first-occurrence-in-a-string.py
Views: 130 | Author: prakhardoneria
1 2 3 4 5 6 7 8 9 | class Solution: def strStr(self, haystack: str, needle: str) -> int: n, m = len(haystack), len(needle) for i in range(n - m + 1): if haystack[i : i + m] == needle: return i return -1 |