#=================================== # Tanzila Islam # Email: tanzilamohita@gmail.com # Language: Python 3 #=================================== class Solution: def strStr(self, haystack: str, needle: str) -> int: h = len(haystack) n = len(needle) for i in range(h): if haystack[i:i+n]==needle: return i return -1
No comments:
Post a Comment