We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 06b68bb commit 54a4711Copy full SHA for 54a4711
hash/2.완주하지 못한 선수.html
@@ -0,0 +1,39 @@
1
+<html>
2
+ <head>
3
+ <meta charset="UTF-8" />
4
+ <title>출력결과</title>
5
+ </head>
6
+ <body>
7
+ <script>
8
+ function solution(participant, completion) {
9
+ let answer = '';
10
+
11
+ const map = new Map();
12
13
+ for (let el of participant) {
14
+ if (map.has(el)) {
15
+ map.set(el, map.get(el) + 1);
16
+ } else {
17
+ map.set(el, 1);
18
+ }
19
20
21
+ for (let el of completion) {
22
+ map.set(el, map.get(el) - 1);
23
24
25
+ for (let [key, value] of map) {
26
+ if (value === 1) return key;
27
28
29
+ answer = participant[0];
30
31
+ return answer;
32
33
34
+ let a = ['leo', 'kiki', 'eden'];
35
+ let b = ['eden', 'kiki'];
36
+ console.log(solution(a, b));
37
+ </script>
38
+ </body>
39
+</html>
0 commit comments