Mental Model
Group words that have the same letters by sorting their letters and using that as a key.
Analogy: Imagine sorting letters of each word like sorting colored beads in a bag; bags with the same colors in the same order belong together.
words: ["eat", "tea", "tan", "ate", "nat", "bat"] keys: ["aet", "aet", "ant", "aet", "ant", "abt"] HashMap: "aet" -> ["eat", "tea", "ate"] "ant" -> ["tan", "nat"] "abt" -> ["bat"]
