Back to problems

Anagram Sentence Substitutions

Algorithm · SoFi · Medium

Requirements You are given wordset, a string array whose entries may form groups of anagrams. You are also given sentences, a string array containing the words of a sentence. Any sentence word may be swapped with a word from wordset when both words are anagrams of each other. Determine how many distinct sentences can be produced after making these replacements. Examples Input: Output: Explanation: aster matches three anagrams in wordset (stare, tears, rates), while pool…

Checking your access…