0028. Find the Index of the First Occurrence in a String
題目
題目大意
解題思路
Big O
- 時間複雜 : ``
- 空間複雜 : ``
來源
- https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/description/
- https://leetcode.cn/problems/
解答
package findtheindexofthefirstoccurrenceinastring
// 暴力解
// 時間複雜 O(M*N), 空間複雜 O()
func strStr(haystack string, needle string) int {
haystackLen := len(haystack)
needleLen := len(needle)
index := 0
for i := 0; i
Benchmark