Company: Typeface_12july
Difficulty: medium
Anagram Difference Problem Description Two words are anagrams of each other when the letters of one can be shuffled to spell the other. You are given two arrays of strings, and for every matching pair of entries you must report the fewest single-character swaps needed on either string so the pair becomes anagrams of each other. If the two strings can never become anagrams, report -1 for that pair instead. Example: a = ['tea', 'tea', 'act'] b = ['ate', 'toe', 'acts'] a[0] = tea and b[0] = ate are already anagrams, so 0 changes are needed. a[1] = tea and b[1] = toe are not anagrams yet. Changing 1 letter in either string (o -> a or a -> o) makes them anagrams. a[2] = act and b[2] = acts are not anagrams and never can be, since they have different lengths. The returned array is [0, 1, -1] . Function Description Complete the function getMinimumDifference in the editor below. getMinimumDifference has the following parameter(s): string a[n] : an array of strings string b[n] : an array of str