You are viewing a single comment's thread. Return to all comments →
I have an even better solution for C#. Only two lines of code:
var dist = (a+b).Distinct();
return dist.Sum(y => Math.Abs(a.Count(x => x == y) - b.Count(x => x == y)));
Seems like cookies are disabled on this browser, please enable them to open this website
Strings: Making Anagrams
You are viewing a single comment's thread. Return to all comments →
I have an even better solution for C#. Only two lines of code:
var dist = (a+b).Distinct();
return dist.Sum(y => Math.Abs(a.Count(x => x == y) - b.Count(x => x == y)));