Problem
Given an array of strings strs, group the anagrams together. You can return the answer in any order.
Examples
Example 1:
Input: strs = ["eat","tea","tan","ate","nat","bat"]
Output: [["bat"],["nat","tan"],["ate","eat","tea"]]
Explanation:
* There is no string in strs that can be rearranged to form "bat".
* The strings "nat" and "tan" are anagrams as they can be rearranged to form each other.
* The strings "ate", "eat", and "tea" are anagrams as they can be rearranged to form each other.Example 2:
Input: strs = [""]
Output: [[""]]Example 3:
Input: strs = ["a"]
Output: [["a"]]Constraints
1 <= strs.length <= 10^40 <= strs[i].length <= 100strs[i]consists of lowercase English letters.
How to participate
Drop your solution as a comment (or link a gist) by May 14, 2026 at noon Pacific Time.
Include:
Your programming language
Brief explanation of your approach
Stated complexity
What I’ll do
By May 16, I’ll publish a Review & Lessons post with:
Annotated feedback on selected submissions
A clean reference solution
Notes on how an interviewer would evaluate your approach.
If you’re short on time this week, at least sketch your approach in prose—that’s still valuable practice.
Upcoming Wednesday paid post will be a detailed analysis of strings and anagrams: sorted key O(n * k log k) vs. frequency tuple O(n * k), prime product hashing trick, interview traps
If you’re a paid subscriber, you also get get exclusive weekly posts and the option to request a private resume/LinkedIn review.
Not paid yet? You can upgrade here:
© The Coding Interview Gym | paulepps.substack.com


