Arrays & Hashing pattern
Group Anagrams
Given an array of strings, group together the ones that are anagrams of each other (use every word exactly once). Return the groups in any order. Watch it run step by step, then write your own pseudocode and get it checked by AI.
- LeetCode 49
- Medium
- 2 approaches
Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.
Arrays & HashingLeetCode 49
Medium
From the first idea to the best one
- 01 Brute force · pairwise O(n²·k log k)O(n·k) space
- 02 Optimized · signature map O(n·k log k)O(n·k) space
What you will learn
- How to read Group Anagrams and spot the arrays & hashing pattern in it
- Brute force · pairwise: O(n²·k log k) time, O(n·k) space
- Optimized · signature map: O(n·k log k) time, O(n·k) space
- The pseudocode for each approach, its line lit as the animation runs
- Practice: write your own pseudocode and get it checked
More Arrays & Hashing
See Group Anagrams run, step by step
Sign in and this page opens on the animation, with all 13 Arrays & Hashing problems beside it.
DSA comes with the all labs plan and every ChaiCode batch.