Valid Anagram

Given two strings *s* and *t*, return `true` if *t* is an anagram of *s*, and `false` otherwise. An anagram is a permutation of the letters of the other string.

Input Format

s = "string1", t = "string2"

Output Format

boolean (true/false)

Constraints

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

Examples

Example 1:

Input:

s = "anagram"
t = "nagaram"

Output:

true

Explanation:

t is a rearrangement of s.

Example 2:

Input:

s = "rat"
t = "car"

Output:

false

Explanation:

t cannot be rearranged to form s.

Loading...
Valid Anagram - Hashing DSA Problem