Inscription Leetcode brush (10) - to achieve strStr

Topics requirements:

Given a string and a needle haystack string, a position of the needle to find the first occurrence of the string (starting from 0) in the haystack string. If not, it returns -1.

answer:

Usage of String class if familiar, then you can use one of the methods isEmpty and indexOf (String str) method directly;

Just started doing too sober mind, go directly to achieve, and do not forget the usual method of the String class, still nested loops, the most frightening thing is finally not being given directly outside the time limit ......

Paste Code seek guidance big brother

 

Guess you like

Origin www.cnblogs.com/wangjm63/p/11494100.html