PYTHON SOLUTION:


  • 0
    P

    '''
    def strStr(self, haystack, needle):
    x=-1
    if len(needle)>0:
    for i in range(len(haystack)):
    if haystack[i:i+len(needle)]==needle:
    x=i
    break
    else:
    x=0
    return x
    '''


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.