See More

Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack. public class Solution { public String strStr(String haystack, String needle) { // Start typing your Java solution below // DO NOT write main() function assert(haystack!=null && needle!=null); if(needle.length()==0) return haystack; int i = 0; while(i