← 返回 amazon 的题目列表Group Anagrams
类型:online_judge
Given an array of strings, group the anagrams together. Return the original indices of these anagrams in the array. Optimize your code to handle both uppercase and lowercase letters.
Example
Input: ['eat', 'tea', 'tan', 'ate', 'nat', 'bat'] Output: [[0, 1, 3], [2, 4], [5]] Note: The order of output does not matter.
Constraints
The number of words is n where 1 ≤ n ≤ 104.
The length of each word is at most 100.
Input words contain only alphabetical characters (case insensitive).
Example
Input
['eat', 'tea', 'tan', 'ate', 'nat', 'bat']