Valid Anagram
Problem statement
Return whether t can be formed by rearranging every character of s exactly once. Character multiplicities must match, and two empty strings are anagrams.
Function
isAnagram(s: String, t: String) → booleanExamples
Example 1
s = "anagram"t = "nagaram"return = trueEach string contains three a letters, one n, one g, one r and one m.
Example 2
s = "rat"t = "car"return = falseThe first string contains t; the second contains c instead.
Constraints
0 <= s.length <= 2000.0 <= t.length <= 2000.- Both strings contain only lowercase English letters a through z.