Skip to content

Commit 023e7f6

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

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

section2/1.큰수출력하기.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 = [];
10+
answer.push(arr[0]);
11+
12+
for (let i = 1; i < arr.length; i++) {
13+
if (arr[i] > arr[i - 1]) {
14+
answer.push(arr[i]);
15+
}
16+
}
17+
18+
return answer;
19+
}
20+
21+
let arr = [7, 3, 9, 5, 6, 12];
22+
console.log(solution(arr));
23+
</script>
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)