Valid Anagram
Updated Jan 31, 2026
Problem
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
Constraints
1 <= s.length, t.length <= 5 * 10^4
s and t consist of lowercase English letters.
Examples
Example 1
Input:
s = "anagram", t = "nagaram"
Output:
true
Example 2
Input:
s = "rat", t = "car"
Output:
false
Function Signature
def isAnagram(self, s: str, t: str) -> bool
How to Submit
Implement a Solution class with a isAnagram method.
Your method will be called with the input parameters and should return the answer.