Skip to content

Commit

Permalink
Merge pull request #26 from yoch/3-solution
Browse files Browse the repository at this point in the history
solution to mutations problem
  • Loading branch information
the-vampiire authored Oct 5, 2018
2 parents 7181a23 + e422726 commit f7b44a9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions intermediate/mutations_yoch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from collections import Counter

def mutations(s1, s2):
c1 = Counter(map(str.lower, s1))
c2 = Counter(map(str.lower, s2))
c1.subtract(c2)
return all(n >= 0 for n in c1.values())

tests = [
(["hello", "Hello"], True),
(["hello", "hey"], False),
(["Alien", "line"], True),
(["hel", "heel"], False)
]

for test, excepted in tests:
ret = mutations(*test)
assert ret == excepted

0 comments on commit f7b44a9

Please sign in to comment.