Solved at: 2022-09-04
Given two strings
t is an anagram of
An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
def isAnagram(self, s: str, t: str) -> bool:
return sorted(s) == sorted(t)
- 129 ms, faster than 6.44% of Python3 online submissions for Valid Anagram.
- 15.1 MB, less than 11.95% of Python3 online submissions for Valid Anagram.
Other Answers Online
- Frequency Counter Map
alphabet → count
- Space: because the map's size is constant.