xxxxxxxxxx
/**
* Return an array of arrays of size *returnSize.
* The sizes of the arrays are returned as *returnColumnSizes array.
* Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().
*/
char *** groupAnagrams(char ** strs, int strsSize, int* returnSize, int** returnColumnSizes){
}
xxxxxxxxxx
#The optimal solution for this problem is to make a hashmap and compare the
#frequency of each letter in each word and club the words having same
#compositions.
def groupAnagrams(strs):
answer=collections.defaultdict(list)
for word in strs:
answer[tuple(sorted(word))].append(word)
return(answer.values())
xxxxxxxxxx
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
}
};
xxxxxxxxxx
class Solution {
public List<List<String>> groupAnagrams(String[] strs) {
}
}
xxxxxxxxxx
public class Solution {
public IList<IList<string>> GroupAnagrams(string[] strs) {
}
}
xxxxxxxxxx
/**
* @param {string[]} strs
* @return {string[][]}
*/
var groupAnagrams = function(strs) {
};
xxxxxxxxxx
# @param {String[]} strs
# @return {String[][]}
def group_anagrams(strs)
end
xxxxxxxxxx
class Solution {
/**
* @param String[] $strs
* @return String[][]
*/
function groupAnagrams($strs) {
}
}