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
Open every published interview problem, solution, scene, and memory room free, with no account.