Implement strStr()
Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
(实现寻找字符串子串函数)
Example:

1. 遍历 – easy
1 | class Solution: |
2. 调用 python 库函数 in, index
1 | class Solution: |
Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
(实现寻找字符串子串函数)
Example:
1 | class Solution: |
1 | class Solution: |