Skip to content

Commit

Permalink
#7 22.10.31 > 장난꾸러기 현수
Browse files Browse the repository at this point in the history
  • Loading branch information
beurmuz committed Oct 31, 2022
1 parent 4a0d2c7 commit 612a54f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/inf/sort,greedy/6_rere.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"use strict";

function solution(arr) {
let answer = [];
let sortArr = arr.slice();
sortArr.sort((a, b) => a - b);
console.log(sortArr);

for (let i = 0; i < arr.length; i++) {
if (arr[i] !== sortArr[i]) {
answer.push(i + 1);
}
}
return answer;
}

let arr = [120, 125, 152, 130, 135, 135, 143, 127, 160];
console.log(solution(arr));
2 changes: 1 addition & 1 deletion src/inf/sort,greedy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
| 3 | O | 22.10.30 |
| 4 | X | 22.10.30😥 |
| 5 | 몰라몰라몰라 | |
| 6 | O | O |
| 6 | O | 22.10.31 |
| 7 || O |
| 8 || O |
| 9 || O |
Expand Down

0 comments on commit 612a54f

Please sign in to comment.