Skip to content

Commit 2dd7074

Browse files
committed
valid-anagram solution
1 parent 89a29ad commit 2dd7074

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

valid-anagram/devyejin.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
from collections import Counter
22
class Solution(object):
33
def isAnagram(self, s, t):
4-
return Counter(s) == Counter(t)
4+
# return Counter(s) == Counter(t)
55

6+
# str에서 제공하는 count 함수 활용
7+
if len(s) != len(t):
8+
return False
9+
for i in set(s):
10+
if s.count(i) != t.count(i):
11+
return False
12+
return True
613

714

0 commit comments

Comments
 (0)