28. Implement strStr()

class Solution {
    public int strStr(String haystack, String needle) {
        if(needle =="" || haystack ==""){
            return 0;
        }

        int l1 = haystack.length(), l2 = needle.length();
        if (l1 < l2) {
            return -1;
        } 
        int threshold = l1 - l2;
        for (int i = 0; i <= threshold; ++i) {
            if (haystack.substring(i,i+l2).equals(needle)) {
                return i;
            }
        }
        return -1;
    }
        
    
}