Problem · String
Group Anagrams
Learn this problemProblem statement
Group the strings in strs so that two strings appear in the same group exactly when they are anagrams.
For deterministic output, sort the strings inside each group and then sort the groups lexicographically by their first string.
Function
groupAnagrams(strs: String[]) → String[][]Examples
Example 1
strs = ["eat","tea","tan","ate","nat","bat"]return = [["ate","eat","tea"],["bat"],["nat","tan"]]Example 2
strs = [""]return = [[""]]More Amazon problems
- Secure Maximum DeliveriesOA · Seen Jul 2026
- Find Median from Data StreamONSITE INTERVIEW · Seen Jul 2026
- Handwritten SigmoidPHONE SCREEN · Seen Jul 2026
- Handwritten SoftmaxPHONE SCREEN · Seen Jul 2026
- Koko Eating BananasONSITE INTERVIEW · Seen Jul 2026
- Loyal Customers Across Two DaysONSITE INTERVIEW · Seen Jul 2026
- Maximum System Memory CapacityOA · Seen Jul 2026
- Package Delivery SystemOA · Seen Jul 2026