[HackerRank][Python3] Strings: Making Anagrams
2018. 7. 15. 00:53 |
프로그래밍/HackerRank
Problem :
https://www.hackerrank.com/challenges/ctci-making-anagrams/problem
My Solution :
#!/usr/bin/env python3 from collections import defaultdict def makeAnagram(a, b): a_dic = defaultdict(int) for c in a: a_dic[c] += 1 for c in b: a_dic[c] -= 1 return sum(abs(x) for x in a_dic.values() if x) a, b = input(), input() res = makeAnagram(a, b) print(res)
'프로그래밍 > HackerRank' 카테고리의 다른 글
[HackerRank][Python3] Greedy Florist (0) | 2018.07.16 |
---|---|
[HackerRank][Python3] Luck Balance (0) | 2018.07.15 |
[HackerRank][Python3] Common Child (0) | 2018.07.15 |
[HackerRank][Python3] Sherlock and the Valid String (0) | 2018.07.15 |
[HackerRank][Python3] Count Triplets (0) | 2018.07.13 |
[HackerRank][Python3] Frequency Queries (0) | 2018.07.13 |
[HackerRank][Python3] Sherlock and Anagrams (0) | 2018.07.12 |
[HackerRank][Python3] Array Manipulation (0) | 2018.07.09 |
최근에 달린 댓글 최근에 달린 댓글