leetcode/0242_valid-anagram/python3/nlogn.py

14 lines
272 B
Python
Raw Normal View History

2022-04-21 08:02:57 +00:00
# Time: O(NlogN)
# Space: O(1)
from collections import Counter
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
slen, tlen = len(s), len(t)
if slen != tlen:
return False
return sorted(s) == sorted(t)