0028. Find the Index of the First Occurrence in a String

題目

題目大意

解題思路

Big O

  • 時間複雜 : ``
  • 空間複雜 : ``

來源

解答

https://github.com/kimi0230/LeetcodeGolang/blob/master/Leetcode/0028.Find-the-Index-of-the-First-Occurrence-in-a-String/main.go

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



© Kimi Tsai all right reserved.            Updated : 2024-05-06 09:36:37

results matching ""

    No results matching ""