Valid Anagram

Given two strings s and t, return true if t is an anagram of s, and false otherwise. Two strings are anagrams when they contain exactly the same characters…

Given two strings `s` and `t`, return `true` if `t` is an anagram of `s`, and `false` otherwise. Two strings are anagrams when they contain exactly the same characters with exactly the same counts — the same letters, possibly in a different order. Strings of different lengths can never be anagrams, and two empty strings are anagrams of each other. For example, given `s = "listen"` and `t = "silent"`, both strings contain one each of `e, i, l, n, s, t`, so the answer is `true`.

- `0 <= s.length, t.length <= 10^5` - Both strings consist of lowercase English letters (`a`–`z`). - Two strings of different lengths can never be anagrams. - Two empty strings are anagrams of each other.

Example 1: input s = "listen", t = "silent"; output true. Both strings contain one each of e, i, l, n, s, t. Same characters with the same counts, so t is an anagram of s.

Example 2: input s = "rat", t = "car"; output false. s contains a, r, t while t contains a, c, r. The character sets differ, so they are not anagrams.

Example 3: input s = "ab", t = "abc"; output false. The strings have different lengths (2 vs 3), so they cannot be anagrams.

Category: Strings. Topic: strings. Difficulty: Easy. Patterns: hashing.