Limits 1s, 512 MB

Given two arrays of words (strings) determine how many of the words in the first array are anagrams of any word in the second array.

Arguments

words: []string

This array of strings will contain words. Each word consists of lower case English alphabets only. The length of each word will be at most 20 characters. This array will have up to 5000 strings in it.

dictionary: []string

This array of strings will contain words just like the other array. This array will have up to 10,000 strings in it.

Return

count: int

Return the total number of words in the words array that have their anagrams in the dictionary array.

Samples

countAnagrams(["cat","team","arc","cow","sing"], ["act","mouse","car","fish","kitten"])
 2
countAnagrams(["cow","hen"], ["cat","dog"])
 0

Submit

Login to submit.

Statistics

100% Solution Ratio
mahdi.hasnatEarliest, Jan '20
NJRafiFastest, 0.0s
mahdi.hasnatLightest, 918 kB
mahdi.hasnatShortest, 325B
Toph uses cookies. By continuing you agree to our Cookie Policy.