FAANG · LeetCode #49
Group Anagrams — three-stage drill
1The ProblemMedium
Group Anagrams
Group together the strings that are anagrams of one another.
Examples
[eat,tea,tan,ate,nat,bat]→ 3 groups
constraintLowercase letters; anagrams share the same sorted letters.
2The PatternTIME O(n) · SPACE O(n)
Arrays & Hashing
Trade space for time: a hash map turns 'have I seen this?' into an O(1) lookup.
Problems using this pattern
3The SolutionRESULT → 3 groups
Step through it
group words sharing the same sorted letters
Step 1 / 8
Arrow keys to navigate · escape to reset