Search
⌘K

Leetcode 820. Short Encoding of Words

Given a list of words, compute the minimum length of a '#'‑terminated reference string that encodes them by noting you can omit any word that is a suffix of another; the result is the sum of lengths of words that are not suffixes of any other word plus one '#' per such word. This reduces to identifying and keeping only words that aren't suffixes of any other word (e.g., via reversed-trie or set-based suffix elimination).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.