Kodebloc

Daily Coding Challenge

Solve today's challenge, earn streaks, and climb the leaderboard!

Share this challenge:
MEDIUM
Released: March 3, 2026 at 12:33 AM

Group Word Anagrams

Given an array of strings, group anagrams together. Anagrams are words that contain the same characters, but in a different order.

Problem Statement

You will receive an array of strings, `strs`. Your task is to group the anagrams from this list. All input strings will consist of lowercase English letters. The order of the output groups and the order of strings within each group does not matter, meaning any valid permutation of groups or elements within groups is acceptable. The solution function will receive `strs` directly as its input. Constraints: - `0 <= strs.length <= 10^4` - `0 <= strs[i].length <= 100` - `strs[i]` consists of lowercase English letters.

Example Test Cases

Input:
strs = ["eat", "tea", "tan", "ate", "nat", "bat"]
Output:
[["bat"], ["nat", "tan"], ["ate", "eat", "tea"]]
Explanation:

The strings 'eat', 'tea', 'ate' are anagrams. 'tan', 'nat' are anagrams. 'bat' is unique. The order of inner arrays and elements within them does not matter for a correct solution.

Input:
strs = ["a"]
Output:
[["a"]]
Explanation:

A single string is grouped by itself.

Sign in to save your progress and compete on the leaderboard

Leaderboard

Group Word Anagrams

No submissions yet for this filter

Be the first to solve this challenge!