3. Valid Anagram

Given two lowercase strings s and t, return true if t is an anagram of s: it uses exactly the same letters, the same number of times.

Example 1

Input: s = "listen", t = "silent"
Output: true

Example 2

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

Constraints

  • 0 ≤ s.length, t.length ≤ 5·10⁴
  • Lowercase English letters only
Hint 1

Two words are anagrams when their letter counts match.

StringCounting