Most common substring of length X

前端 未结 8 2160
没有蜡笔的小新
没有蜡笔的小新 2021-02-09 13:49

I have a string s and I want to search for the substring of length X that occurs most often in s. Overlapping substrings are allowed.

For example, if s=\"aoaoa\" and X=3

8条回答
  •  囚心锁ツ
    2021-02-09 14:38

    There's no way to do this in O(n).

    Feel free to downvote me if you can prove me wrong on this one, but I've got nothing.

提交回复
热议问题