src.valid_anagram¶
Classes
|
- class src.valid_anagram.Solution[source][source]¶
- isAnagram(s: str, t: str) bool [source]¶
Thought process¶
Trivially if the words have a different length we return False
We create two dictionaries to store the frequency of each character in the words
We compare the dictionaries to see if they are equal
Notes¶
time complexity: \(O(n)\)
space complexity: \(O(n)\)