xxxxxxxxxx
//anagram checking
const anagramCheck=(str1,str)=>{
//important note is that do not add spaces in split and join otherwise it will
//return the value as false
str1 =str1.toLowercase().split("").sort().join("");
str2 = str2.toLowercase().split("").sort().join("");
//now the comparison of those two strings
return str1 === str2
}
console.log(anagramCheck("cat","act"),"solution by Shoaib Khan")//it will return true
xxxxxxxxxx
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
}
};
xxxxxxxxxx
class Solution {
public List<List<String>> groupAnagrams(String[] strs) {
}
}
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
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) {
}
}