3 ms·
With brute-force you have no idea about what letters could follow a given letter, but with a Trie you already know the possible combinations so you avoid needle
by karterk 5y ago
With brute-force you have no idea about what letters could follow a given letter, but with a Trie you already know the possible combinations so you avoid needless permutations.