Medium · Strings
Count Words Obtained After Adding a Letter
Given two arrays of lowercase words, startWords and targetWords, where no word repeats a letter, return how many target words can be formed by appending to some start word one letter it does not already contain and then rearranging the letters in any order.
Examples
Example 1
{
"startWords": ["ant", "act", "tack"],
"targetWords": ["tack", "act", "acti"]
}Output: 2 words
Example 2
{
"startWords": ["ab", "a"],
"targetWords": ["abc", "abcd"]
}Output: 1 word
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.