33/35
Part 7 of 7 · Follow-upsLearn
The tests you'd write cover a word inside another, empty and missing prefixes, and repeats
Test the cases a trie gets wrong first.
- A word that's a prefix of another, in both orders of insertion.
- The empty prefix.
- A prefix nobody has.
- A word inserted twice, if the caller can do that.
- Deleting a word that isn't there, and deleting the only word under a branch.
- For fragments: a fragment repeated inside one name, a name inside another, a tie between two fragments of the same length, and removing then adding back the same name.