DisneyRole: Senior Software EngineerSeptember 2026
Interview question
Given two arrays a and b of n lowercase strings, return for each pair a[i], b[i] the minimum number of character replacements in either string required to make them anagrams, or -1 if impossible. For a=["tea","tea","act"] and b=["ate","toe","acts"], return [0,1,-1]. Constraints: 1<=n<=100; each string length is 0..10000 and each pair has combined length 1..10000.
Follow-up questions
- Why do you divide the sum of absolute character-frequency differences by two?