public class Solution {
public String strStr(String haystack, String needle) {
if(needle == "") {
return haystack;
}
for(int i = 0; i <= haystack.length() - needle.length(); i++) {
if(haystack.substring(i, i + needle.length()).equals(needle) == true) {
return haystack.substring(i, haystack.length());
}
}
return null;
}
}
Time: O(m * n)
Space: O(1)