파이썬 알고리즘 인터뷰 62번(리트코드 242) Valid Anagram
https://leetcode.com/problems/valid-anagram/
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
if len(s) != len(t):
return False
s_count = collections.Counter(s)
t_count = collections.Counter(t)
for char in s_count:
if s_count[char] != t_count[char]:
return False
return True
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
return sorted(s) == sorted(t)