Skip to content

Practice Valid Anagram

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#242
LeetCode Problem

Valid Anagram

Problem Statement

Given two strings s and t, return true if t is an anagram of s, and false otherwise. Follow up: What if the inputs contain Unicode characters? How would you adapt your solution to such a case?

Source: Valid Anagram on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "anagram", t = "nagaram"
Output
true

# Example 2

Input
s = "rat", t = "car"
Output
false

Constraints

1 <= s.length, t.length <= 5 * 10^4
s and t consist of lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Valid Anagram.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.