Python | Three Simple Solutions | From O(nlogn) To O(n)
O(nlogn)\n\nclass Solution:\n    def isAnagram(self, s: str, t: str) -> bool:\n        return sorted(s) == sorted(t)\n\nO(n)\n\nclass Solution:\n    from collec
O(nlogn)\n```\nclass Solution:\n    def isAnagram(self, s: str, t: str) -> bool:\n        return sorted(s) == sorted(t)\n```\nO(n)\n```\nclass Solution:\n    from collections import Counter\n    def isAnagram(self, s: str, t: str) -> bool:\n        if len(s) != len(t): return False\n        s_counter, t_counter = Counter(s), Counter(t)\n        for c in s_counter:\n            if s_counter[c] != t_counter[c]: return False\n        return True\n```\nO(n)\n```\nclass Solution:\n    def isAnagram(self, s, t):\n        return Counter(s) == Counter(t)
['Python']