Anagram
Valid Anagram
- Using hash table or array of 256 to store string a
- Iterate through b to check if characters match
Group Anagrams
- We need to use a hash map unordered_map
to store each group - We will use a sorted version of each anagram as the key
- There are two ways to find the sorted anagram for each word
- The first one is to use sorting, then check if key exist
- The second one is to use array to count each character in word, then iterate through the array to get the sorted key.