Return whether t is an anagram of s: both strings must contain the same lowercase letters with the same multiplicities, possibly in a different order.
Pattern: Frequency counting with a balance map
s adds one credit, and every character in t spends one credit.k distinct characters; sorting is simpler but costs O(n log n).Input / output
s: string, t: stringExamples
s = "anagram", t = "nagaram" returns true.s = "rat", t = "car" returns false.Constraints
0 <= s.length, t.length <= 100,000Follow-up How would full Unicode support change the counting and normalization strategy?