Optimal Algorithmic Approach
HashMap with sorted-string keys.
Core Invariants & Edge Cases
- Sort each string to form a canonical key
- Use the sorted string as a HashMap key; group original strings under it
- Alternative: character-count tuple as key (faster for long strings)