Fundamentals/Is Anagram
← PrevNext →
Given two strings, return true if they are anagrams of each other. Two strings are anagrams when they contain the same characters with the same frequencies, just rearranged.
Input
s: the first string
t: the second string
Output
true if s and t are anagrams, false otherwise.
Examples
Example 1
Inputs = "listen", t = "silent"
Outputtrue
Example 2
Inputs = "rat", t = "car"
Outputfalse
Constraints
s and t may be empty.
Two empty strings are considered anagrams.