Pergunta de entrevista da empresa MathWorks

Problem involving counting anagrams efficiently