Skip to content

📚 4.实现strStr()

💻 代码实现

typescript
/**
 * @url https://leetcode.cn/problems/find-the-index-of-the-first-occurrence-in-a-string/description/
 * @description 实际考察kmp算法,// todo
 */
function strStr(haystack: string, needle: string): number {
    return haystack.indexOf(needle)
}

Released under the MIT License.