Ezvor

1698. Number of Distinct Substrings in a String

MediumString Preparing judge… LeetCode
StringTrieRolling HashSuffix ArrayHash Function

Hints

Hint 1
Calculate the prefix hashing array for s.
Hint 2
Use the prefix hashing array to calculate the hashing value of each substring.
Hint 3
Compare the hashing values to determine the unique substrings.
Hint 4
There could be collisions if you use hashing, what about double hashing.