dsa8 min read
Count Distinct Substrings — Suffix Array, Suffix Automaton, and Rolling Hash
Counting distinct substrings of a string is the gateway problem to suffix arrays and suffix automata. Three classical solutions — n^2 hash set, suffix array plus LCP, and suffix automaton — span the full toolbox of competitive programming and FAANG hard interviews.
Read →