-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalgo_4-5.html
31 lines (29 loc) · 1006 Bytes
/
algo_4-5.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<html>
<head>
<meta charset="UTF-8">
<title>출력결과</title>
</head>
<body>
<script>
function solution(n, k, card){
let answer;
let p = [];
document.write([13, 15, 34, 23, 45, 65, 33, 11, 26, 42]);
for (let i = 0; i <= arr.length; i++) {
for (let j = i + 1; j < arr.length; j++) {
for (let k = j + 1; k < arr.length; k++) {
p.push(arr[i] + arr[j] + arr[k]);
p.sort(function(a, b) {
return b - a;
});
answer = p[2];
}
}
}
return answer;
}
let arr=[13, 15, 34, 23, 45, 65, 33, 11, 26, 42];
console.log(solution(10, 3, arr));
</script>
</body>
</html>