Skip to content

Commit a5de337

Browse files
authored
Update 893-groups-of-special-equivalent-strings.js
1 parent cb07aac commit a5de337

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

893-groups-of-special-equivalent-strings.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,22 @@ const numSpecialEquivGroups = function(A) {
1414
)
1515
).size;
1616
};
17+
18+
// another
19+
20+
/**
21+
* @param {string[]} A
22+
* @return {number}
23+
*/
24+
const numSpecialEquivGroups = function(A) {
25+
const result = new Set();
26+
for (let i of A) {
27+
let arr = i.split("");
28+
let res = [[], []];
29+
for (let j = 0; j < arr.length; j++) {
30+
res[j & 1].push(arr[j]);
31+
}
32+
result.add(res[0].sort().join("") + res[1].sort().join(""));
33+
}
34+
return result.size;
35+
};

0 commit comments

Comments
 (0)