dsa · easy
Valid Anagram
GreyOrangeStringHash MapFoundation
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
**Example 1:** `` Input: s = "anagram", t = "nagaram" Output: true ` **Example 2:** ` Input: s = "rat", t = "car" Output: false ``
Arguments
s— the first stringt— the second string; return whether it is an anagram ofs
Constraints
1 <= s.length, t.length <= 5 * 10^4 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.
Examples
Example 1
Input: anagram nagaram Expected: true
Example 2
Input: rat car Expected: false