The First Occurrence of Needle In Haystack

吴宏扬
2023-12-01

The problem is:

Implement strStr().

Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.

A naive method: (1) find the the first letter of needle in haystack, (2)comparing other consecutive characters of needle and haystack, (3) if all letters in needle can be found in haystack consecutively, then return the position in haystack.

- See more at: http://bo-yang.github.io/2014/07/01/strstr/#sthash.dvdv0jfs.dpuf

 http://bo-yang.github.io/2014/07/01/strstr

 类似资料:

相关阅读

相关文章

相关问答