Group Anagrams Problem

Group Anagrams Problem — ExecCode Easy DSA Practice

Solve the Group Anagrams problem on ExecCode. Free online easy DSA practice in Hashing. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.

Examples

Input strs = ["eat", "tea", "tan", "ate", "nat", "bat"]; Output [["eat", "tea", "ate"], ["tan", "nat"], ["bat"]]. Input strs = [""]; Output [[""]]. Input strs = ["a"]; Output [["a"]]

Constraints

1 ≤ strs.length ≤ 10⁴ 0 ≤ strs[i].length ≤ 100 strs[i] consists of lowercase English letters

Practice Group Anagrams free on ExecCode. Browse DSA problems, topic map, and placement guides.