Skip to content

Commit 73a4661

Browse files
committed
제일 작은 수 제거하기, 중급
1 parent 0bbc32d commit 73a4661

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

unn04012/array/delete_min_num.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function solution(arr) {
2+
const answer = [];
3+
const minNum = Math.min(...arr);
4+
5+
for (const e of arr) {
6+
if (e === minNum) continue;
7+
answer.push(e);
8+
}
9+
return answer.length ? answer : [-1];
10+
}

0 commit comments

Comments
 (0)