Search
⌘K
Get Premium
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.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.