|
|
|
|
|
by davisp
5453 days ago
|
|
The issue there is that you're still anchoring your index to one end of the string which means you're not solving the general problem, only a specific manifestation of it. A general example would be given the string "foo bar baz", your solution could find "foo%" or "%baz" efficiently, but not "%bar%". Its not out of the question if what you really want is a suffix search, but the general problem of finding an internal substring is still less than optimal. Edit: Formatting |
|