Search
⌘K

Leetcode 2306. Naming a Company

Count the number of ordered pairs of distinct words (A, B) from a list such that swapping their first letters produces two new words that do not appear in the original list. The challenge is to do this efficiently for up to 5·10^4 words by exploiting the structure of shared suffixes and overlaps among first-letter groups.


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.