Warm-ups · 20 of 24
Check if two strings are anagrams
Return true if t uses exactly the same characters as s, the same number of times each, in any order.
Examples
Input s = "listen", t = "silent"
Output true
Input s = "rat", t = "car"
Output false
📘 New to this? Counting with a hash map explains the idea in a few minutes.
Solved it? The same idea on LeetCode: try it there ↗