'''
Author: 365JHWZGo
Description: 28. 实现 strStr()
Date: 2021-09-30 11:09:00
FilePath: \Python\test\demo2.py
LastEditTime: 2021-10-02 21:28:48
LastEditors: 365JHWZGo
'''
class Solution(object):
def strStr(self, haystack, needle):
"""
:type haystack: str
:type needle: str
:rtype: int
"""
if haystack=='' and needle=='':
return 0
elif haystack == '' :
return -1
elif needle == '':
return 0
else:
return haystack.find(needle)
28. 实现 strStr()
最新推荐文章于 2024-07-28 15:46:11 发布