function anagrams
-
given an anagram key
ak, an initial set of partial angramspase.g
ak= "adeor",pas= #{"a", "are", "dare" ...}- For each partial anagram
painpas,-
Let
key-diffbe the multiset difference betweenpaandake.g
pa= "a",key-diff= "deaor"- If
pascontainskey-diff, then [pakey-diff] is a solution, and we can move on to the next iteration ofpa - Else,
pamay be a solution, but we have to check by calling anagrams recursively with the leftovers, that is, the partial anagrams we can make from the multiset difference betweenpaandkey-diff- This is where I start to get lost... How do I conver this to a recursive function?
- If
-
- For each partial anagram