https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/
미디움이라고 하지만, 전혀 미디움 난이도가 아닌 문제
class Solution(object):
def strStr(self, haystack, needle):
"""
:type haystack: str
:type needle: str
:rtype: int
"""
if needle in haystack :
return haystack.index(needle)
return -1
댓글