Search
⌘K

Leetcode 2156. Find Substring With Given Hash Value

Find the earliest length-k substring of s whose polynomial rolling hash (sum of val(ch)*power^i mod modulo) equals hashValue. This requires using modular arithmetic and an efficient rolling-hash/sliding-window approach to check all length-k substrings in O(n) time.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.