原题
https://leetcode.cn/problems/find-the-index-of-the-first-occurrence-in-a-string/description/
思路
调接口
复杂度
时间:O(n)
空间:O(1)
Python代码
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
return haystack.find(needle)
Go代码
func strStr(haystack string, needle string) int {
return strings.Index(haystack, needle)
}

被折叠的 条评论
为什么被折叠?



