Skip to content

Commit 6ac93fb

Browse files
committed
�� 踰�留� �깆媓�� 臾몄� / 湲곗�
1 parent ac894b6 commit 6ac93fb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function solution(s) {
2+
const charSet = new Set();
3+
const duplicateSet = new Set();
4+
5+
for (const char of s) {
6+
if (charSet.has(char)) {
7+
duplicateSet.add(char);
8+
} else {
9+
charSet.add(char);
10+
}
11+
}
12+
13+
const uniqueChars = [...charSet].filter((char) => !duplicateSet.has(char));
14+
15+
return uniqueChars.sort().join("");
16+
}

0 commit comments

Comments
 (0)