Skip to content

Commit 864182b

Browse files
committed
valid-anagram solution
1 parent 985dc96 commit 864182b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

valid-anagram/krokerdile.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution:
2+
def isAnagram(self, s: str, t: str) -> bool:
3+
a = {}
4+
b = {}
5+
6+
if len(s) != len(t):
7+
return False
8+
9+
for i in range(len(s)):
10+
a[s[i]] = a.get(s[i], 0) + 1
11+
b[t[i]] = b.get(t[i], 0) + 1
12+
13+
return a == b

0 commit comments

Comments
 (0)