Search
⌘K
Get Premium
Leetcode 28. Find the Index of the First Occurrence in a String
Given two strings, return the starting index of the first occurrence of needle in haystack, or -1 if absent. This is a classic substring search problem (input lengths up to ~10^4), requiring identification of the earliest match.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.