索引:[LeetCode] Leetcode 題解索引 (C++/Java/Python/Sql)
Github:
https://github.com/illuz/leetcode
題目:https://oj.leetcode.com/problems/implement-strstr/
代碼(github):https://github.com/illuz/leetcode
在1個字符串里找另外一個字符串在其中的位置。
這題歸在 Easy 類是由于它 O(n*n) 的暴力能過。
如果數據強點就得 Midium 以上了。
((hash << 5) + hash)
很快,不過 int 范圍只能 hash 6 個字母而且 rolling 的時候還是要
/33
,還是用 29 算了),超 int 范圍的話用 Python 就不用斟酌這個問題了。其他還有 Boyer
上一篇 下載配置編譯openwrt
下一篇 C++ 實現線程安全的任務隊列