You are viewing a single comment's thread. Return to all comments →
My python solution: Time: O(n) Space: O(n)
def makingAnagrams(s1, s2): freq = [0]*26 min_del = 0 for c in s1: freq[ord(c)-ord('a')] += 1 for c in s2: freq[ord(c)-ord('a')] -= 1 for val in freq: min_del += abs(val) return min_del
Seems like cookies are disabled on this browser, please enable them to open this website
Making Anagrams
You are viewing a single comment's thread. Return to all comments →
My python solution: Time: O(n) Space: O(n)