Skip to content

Commit 39fe412

Browse files
author
임빛나
committed
완전탐색 업데이트
1 parent 54a4711 commit 39fe412

File tree

3 files changed

+67
-8
lines changed

3 files changed

+67
-8
lines changed

3.가위바위보.html

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@
66
<body>
77
<script>
88
function solution(a, b) {
9-
let answer = "";
9+
let answer = '';
1010

1111
a.forEach((ele, index) => {
1212
if (a[index] === b[index]) {
13-
answer = answer + "D ";
13+
answer = answer + 'D ';
1414
}
1515
if (a[index] === 1 && b[index] === 2) {
16-
answer = answer + "B ";
16+
answer = answer + 'B ';
1717
}
1818
if (a[index] === 1 && b[index] === 3) {
19-
answer = answer + "A ";
19+
answer = answer + 'A ';
2020
}
2121
if (a[index] === 2 && b[index] === 1) {
22-
answer = answer + "A ";
22+
answer = answer + 'A ';
2323
}
2424
if (a[index] === 2 && b[index] === 3) {
25-
answer = answer + "B ";
25+
answer = answer + 'B ';
2626
}
2727
if (a[index] === 3 && b[index] === 1) {
28-
answer = answer + "B ";
28+
answer = answer + 'B ';
2929
}
3030
if (a[index] === 3 && b[index] === 2) {
31-
answer = answer + " A";
31+
answer = answer + ' A';
3232
}
3333
});
3434

stack/1.같은 숫자는 싫어.html

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(arr) {
9+
let answer = [arr[0]];
10+
11+
for (let i = 1; i < arr.length; i++) {
12+
if (answer[answer.length - 1] !== arr[i]) {
13+
answer.push(arr[i]);
14+
}
15+
}
16+
return answer;
17+
}
18+
19+
let a = [4, 4, 4, 3, 3];
20+
21+
console.log(solution(a));
22+
</script>
23+
</body>
24+
</html>
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(sizes) {
9+
let left = [];
10+
let right = [];
11+
12+
let rotated = sizes.map((size) => {
13+
return size.sort((a, b) => a - b);
14+
});
15+
16+
rotated.forEach(([le, ri]) => {
17+
left.push(le);
18+
right.push(ri);
19+
});
20+
21+
return Math.max(...left) * Math.max(...right);
22+
}
23+
24+
let sizes = [
25+
[14, 4],
26+
[19, 6],
27+
[6, 16],
28+
[18, 7],
29+
[7, 11],
30+
];
31+
32+
console.log(solution(sizes));
33+
</script>
34+
</body>
35+
</html>

0 commit comments

Comments
 (0)