LeetCode 820 (Medium). Short Encoding of Words
I'm a sucker for any coding challenges involving words. Here's one that is basically about counting how many words are suffixes of other words. I wrote a trie with an idiosyncratic
add() method that tracks the number of words that aren't prefixes of any other words and how many characters are in those non-prefix words. Those two details are used to formulate the single integer answer that the problem asks for. Fun to write!