21. Valid Anagram
Easy · String
Given two strings s and t, determine if t is an anagram of s. An anagram is a word or phrase formed by rearranging the letters of another, using each letter exactly once.
Both strings contain only lowercase English letters.
Examples
Example 1 Input: s = "listen", t = "silent" Output: true Explanation: Both strings contain the same characters with the same frequencies: l(1), i(1), s(1), t(1), e(1), n(1).
Example 2 Input: s = "hello", t = "world" Output: false Explanation: The strings have different character frequencies. 'hello' has h, e, l(2), o while 'world' has w, o, r, l, d.
Constraints
- Standard input/output constraints apply