Implement strstr() function


  • 0
    P
    public int strStr(String haystack, String needle) {
              if(haystack.contains(needle)) {
                  return haystack.indexOf(needle);
    	    }
    	      return -1;
        }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.