Skip to content

Commit b742851

Browse files
committed
add solution in Python for 0028_find_the_index_of_the_first_occurrence.py
1 parent 0a72931 commit b742851

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def strStr(self, haystack: str, needle: str) -> int:
2+
for i in range(len(haystack)):
3+
if(haystack[i:len(needle) + i] == needle):
4+
return i
5+
6+
return -1

0 commit comments

Comments
 (0)