October 31, 2024
This was an easy problem.
1class Solution:2 def strStr(self, haystack: str, needle: str) -> int:3 for j in range(len(haystack)):4 if haystack[j:j + len(needle)] == needle:5 return j6 return -1
O(n) = n
LeetCode 6. Zigzag Conversion
LeetCode 68. Text Justification