28. Implement strStr()
- Total Accepted: 161415
- Total Submissions: 592859
- Difficulty: Easy
- Contributors: Admin
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Subscribe to see which companies asked this question.
Show Similar Problems
Have you met this question in a real interview?
Yes
public class Solution {
public int strStr(String haystack, String needle) {return haystack.indexOf(needle);
}
}