Valid Anagram
Given two strings s and t, return true if t is an anagram of s: it uses exactly the same letters, each the same number of times, in any order.
Constraints
- 1 ≤ length of
s, length oft≤ 50,000 sandthave lower-case English letters only.
Example 1
Input
s = "listen"
t = "silent"
Output
true
Why:
Both have one each of e, i, l, n, s and t.
Example 2
Input
s = "rat"
t = "car"
Output
false
Why:
rat has a t and car has a c.
Hints
Was this a good challenge?
- Solved by
- 0
- Submissions
- 0
- Accepted
- –