Skip to content

Commit 55c756a

Browse files
committed
98차 3번 문제풀이
1 parent df0353b commit 55c756a

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

live9/test98/문제3/조진우.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
function solution(prices) {
2+
const answer = [];
3+
4+
for (let i = 0; i < prices.length; i++) {
5+
let seconds = 0;
6+
let j = i + 1;
7+
8+
while (true) {
9+
if (j >= prices.length) break;
10+
11+
seconds++;
12+
13+
if (prices[j] < prices[i]) break;
14+
15+
j++;
16+
}
17+
18+
answer.push(seconds);
19+
}
20+
21+
return answer;
22+
}
23+
24+
console.log(solution([1, 2, 3, 2, 3]));

0 commit comments

Comments
 (0)