Valid Anagram
Return whether s and t contain exactly the same multiset of letters.
Example 1
s = "silent"
t = "listen"trueExplanation
Both words contain one each of e, i, l, n, s and t; their order does not change the counts.
Example 2
s = "abb"
t = "aba"falseExplanation
abb has two b letters while aba has two a letters; equal lengths alone are insufficient.
Example 3
s = ""
t = ""trueExplanation
Two empty strings have the same zero count for every letter.
Constraints
- 0 <= string lengths <= 50000
- Strings contain lowercase English letters
Function contract
isAnagramArguments: json, jsonSolutionRuns on your device
Loading draft…
Run: 3 examples; Submit: 34 cases, on your device.
"silent""listen"