Skip to content

Commit 1472b1e

Browse files
committed
알고리즘 풀이 업데이트
1 parent 023e7f6 commit 1472b1e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

2.보이는학생.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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 = 1;
10+
let maxheight = arr[0];
11+
12+
for (let h of arr) {
13+
if (h > maxheight) {
14+
maxheight = h;
15+
answer++;
16+
}
17+
}
18+
return answer;
19+
}
20+
21+
let arr = [130, 135, 148, 140, 145, 150, 150, 153];
22+
console.log(solution(arr));
23+
</script>
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)