update project structure

This commit is contained in:
2024-06-20 06:29:07 +08:00
parent 17b4ef8970
commit fdaa94a0fa
49 changed files with 35 additions and 4 deletions

12
leetcode_py/28.py Normal file
View File

@@ -0,0 +1,12 @@
"""
Given two strings needle and haystack,
return the index of the first occurrence of needle in haystack,
or -1 if needle is not part of haystack.
"""
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
if needle in haystack:
return haystack.find(needle)
else:
return -1