Valid Anagram

easyArrays & Hashingchar frequency hash mapB75Solve on LeetCode#242

Part of Practice: Hashing Warmups

Given two strings s and t, decide whether t is an anagram of s. An anagram is a word formed by rearranging the letters of another word, using every letter exactly once — so both strings must contain exactly the same letters with exactly the same counts.

Both strings consist of lowercase English letters and can be up to 50,000 characters long.

Examples

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

Both strings contain three a's, one n, one g, one r, and one m.

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

s has a t but t has a c; the letter multisets differ.

Hints

One at a time — struggle first, peek second.

Your thinking space — verify on LeetCode, then mark it.