Leetcode 242: Valid Anagram
Problem Statement Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Example 1: Input: s = "anagram", t = "nagaram" Output: true Example 2: Input: s = "rat", t = "car" Output: false Solution Python Implementation from collections import Counter class Solution: def isAnagram(self, s: str, t: str) -> bool: """ T: O(N) = max(S + T) S: O(N) """ s_mp = Counter(s) t_mp = Counter(t) return s_mp == t_mp Leetcode 242: Valid Anagram