Valid Anagram

Problem Id: 242 Difficulty: Easy


Intuition

Solution


class Solution:
    def _count(self, s):
        result = []
        for c in string.ascii_lowercase:
            result.append(s.count(c))
        return result

    def isAnagram(self, s: str, t: str) -> bool:
        for i, j in zip(self._count(s), self._count(t)):
            if i != j:
                return False
        return True