You are viewing a single comment's thread. Return to all comments →
Pretty cool solution. Here is the solution in python
from math import fabs def number_needed(a, b): letterArray = [0] * 26 for c in a: index = ord(c) - ord('a'); letterArray[index]+=1 for c in b: index = ord(c) - ord('a') letterArray[index]-=1 result = 0 for i in letterArray: result += fabs(i) return int(result) a = raw_input().strip() b = raw_input().strip() print number_needed(a, b)
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 →
Pretty cool solution. Here is the solution in python