We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b2b53df commit edb98f5Copy full SHA for edb98f5
scripts/algorithms/R/Redistribute Characters to Make All Strings Equal/Redistribute Characters to Make All Strings Equal.js
@@ -1,23 +1,23 @@
1
+// Runtime: 144 ms (Top 34.85%) | Memory: 45.3 MB (Top 50.00%)
2
/**
3
* @param {string[]} words
4
* @return {boolean}
5
*/
6
var makeEqual = function(words) {
-
7
+
8
let length = words.length
9
10
let map = {}
11
for( let word of words ) {
12
for( let ch of word ) {
13
- map[ch] = ( map[ch] || 0 ) + 1
+ map[ch] = ( map[ch] || 0 ) + 1
14
}
15
16
17
for( let key of Object.keys(map)) {
18
if( map[key] % length !=0 ) return false
19
20
21
return true
22
23
-};
+};
0 commit comments