吾生也有涯,而知也无涯 。以有涯随无涯,殆已!
Problem : https://leetcode.com/problems/valid-anagram/
Use hash table to count the characters in the string.
class Solution: def isAnagram(self, s: str, t: str) -> bool: return Counter(s) == Counter(t)
No comments:
Post a Comment