python-algorithm

Leetcode 28. Implement strStr()

무적김두칠 2021. 7. 13. 16:03

1
2
3
4
class Solution:
    def strStr(self, haystack: str, needle: str-> int:
        if needle in haystack : return (haystack.index(needle))
        elsereturn -1
cs
반응형