Skip to content

Commit 6b1a09f

Browse files
committed
알고리즘 풀이 업데이트
1 parent 58b486b commit 6b1a09f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

section1/17.중복단어제거.html

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(s) {
9+
let answer = [];
10+
11+
const map = new Map();
12+
13+
for (let word of s) {
14+
if (!map.has(word)) {
15+
map.set(word, true);
16+
answer.push(word);
17+
}
18+
}
19+
20+
return answer;
21+
}
22+
let str = ['good', 'time', 'good', 'time', 'student'];
23+
console.log(solution(str));
24+
</script>
25+
</body>
26+
</html>

0 commit comments

Comments
 (0)