JavaScript || Count || O( n * w) || n words, w word length
Suppose total number of words in given input are n. If we want to make all words equal, it means same count of characters should be there in every word in the e
Suppose total number of words in given input are **n**. If we want to make all words equal, it means same count of characters should be there in every word in the end result. \n\nIf we calculate count of each character in all words then every character can be distributed equally among all words only if its **count % n == 0** else we cannot distribute it and ans will be false.\n\nfor e.g \n\nwords = ["abc","aabc","bc"], n = 3\ncount map :\na - 3\nb - 3\nc - 3\nall three counts have % 3 = 0.\n\n["ab","abb","aaaa"], n = 3\n\na - 6\nb - 3\n\nall three counts have % 3 = 0.\n\n["ab","abb"], n = 2\n\na - 2\nb - 3\nwe cannot distribute \'b\' equally among n, means %n ==0 is not true for all counts.\n\n\n**Time Complexity**: O( 100 * 100), max number of words are 100 & max length of a single word is 100.\n\nif n = total words, w = word length then **O( n * w)**\n\n\n```\n/**\n * @param {string[]} words\n * @return {boolean}\n */\nvar makeEqual = function(words) {\n    \n    \n    let length = words.length\n    \n    let map = {}\n    for( let word of words ) {\n        for( let ch of word ) {\n            map[ch] = ( map[ch] || 0 )  + 1 \n        }\n    }\n    \n    for( let key of Object.keys(map)) {\n        if( map[key] % length !=0 ) return false\n    }\n    \n    return true\n    \n};\n```
['JavaScript']