Implement a function to find the first occurrence of a substring (needle) in a string (haystack). Return the starting index of the first occurrence, or -1 if the substring is not found.
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.