9/17/2020

[LeetCode] 242. Valid Anagram

 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