Skip to content

Commit 9bd72f9

Browse files
committed
Runtime: 996 ms (Top 33.98%) | Memory: 14.1 MB (Top 94.23%)
1 parent 50f7945 commit 9bd72f9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/algorithms/F/Find Substring With Given Hash Value/Find Substring With Given Hash Value.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Runtime: 996 ms (Top 33.98%) | Memory: 14.1 MB (Top 94.23%)
12
class Solution:
23
def subStrHash(self, s: str, power: int, mod: int, k: int, hashValue: int) -> str:
34
val = lambda ch : ord(ch) - ord("a") + 1
@@ -7,4 +8,4 @@ def subStrHash(self, s: str, power: int, mod: int, k: int, hashValue: int) -> st
78
if i < len(s) - k:
89
hash = (mod + hash - power_k * val(s[i + k]) % mod) % mod
910
res = i if hash == hashValue else res
10-
return s[res:res + k]
11+
return s[res:res + k]

0 commit comments

Comments
 (0)