--- tags: AC LeetCode 刷題讀書會 - 2023 --- # 2023/10/22 (日) 每週 LeetCode 刷題 ## 刷題題號 - [28. Find the Index of the First Occurrence in a String](https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string) ## 解題思路 Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. For the purpose of this problem, we will return 0 when needle is an empty string. <pre style='background-color:#ggg'> 給予兩個字串「needle」、「haystack」,回傳「needle」在「haystack」相符的"第一個"陣列位置,如不符合則回傳-1。 當「needle」為空值時,回傳0。 </pre> ## 回報格式 - 請 Fork 此 Replit 連結(https://replit.com/@AllenLi23/AC-LeetCode-Js-28-Find-the-Index-of)後,進行程式碼解題,並於完成後更新到 Replit 中,再將連結貼至「解題分享區」來與大家交流做法。 解題分享區 --- 讀書會議流程: #簽到表: https://docs.google.com/spreadsheets/d/1gc16rrF-yZNs845z_nYrdgDIiSECOJok30dNLyQm69A/edit#gid=534323210 1. 題目說明。 2. 題目解析(BigO(n * log(m)))。 4. 成員分享解題思路。 5. 問題與討論。 <!-- No.0 (請依序排序下去) name: name (回報範例) lighthouse: lighthouse Replit:https://replit.com/@AllenLi23/AC-LeetCode-Js-28-Find-the-Index-of-Allen --> <!-- No.1 name: Jack Hung lighthouse: lhhungx@gmail.com Replit:https://replit.com/@LungHsuanHung/AC-LeetCode-Go-28-Find-the-Index-Of-The-1st-Occur-In-A-Str#solution/solution.go --> <!-- No.2 name: Kai lighthouse: pythonforeye@gmail.com Replit:https://replit.com/@Beginneraboutli/AC-LeetCode-Js-28-Find-the-Index-of#index.js --->