As reported: Cisco (4.5 years of experience), technical round 1 (2025): Group Anagrams, after Next Greater Element.
Given an array of strings strs, group the anagrams together (words with the same letters in a different order). Groups and words within a group may be returned in any order.
This is LeetCode 49 — Group Anagrams.
Example 1
strs = ["eat","tea","tan","ate","nat","bat"] -> [["ate","eat","tea"],["bat"],["nat","tan"]]
Example 2
strs = [""] -> [[""]]
Constraints: 1 ≤ strs.length ≤ 10^4; 0 ≤ strs[i].length ≤ 100; lowercase English letters.
Code runner format: one line, strs as JSON. Implement groupAnagrams(strs); the harness sorts each group and the groups before printing, so any order is accepted.