28. 找出字符串中第一个匹配项的下标

逐字符匹配。

难度:简单。题型:Brute Force。

标签:字符串、双指针

朴素匹配:遍历 haystack 逐段比较。 时间复杂度 O(n*m),空间复杂度 O(1)。