Skip to content

Commit

Permalink
#7 22.11.01 > 좌표 정렬
Browse files Browse the repository at this point in the history
  • Loading branch information
beurmuz committed Nov 1, 2022
1 parent bc253e8 commit 7bc69ea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/inf/sort,greedy/7_rere.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"use strict";

function solution(arr) {
let answer = arr;
arr.sort((a, b) => {
if (a[0] === b[0]) return a[1] - b[1];
return a[0] - b[0];
});
return answer;
}

let arr = [
[2, 7],
[1, 3],
[1, 2],
[2, 5],
[3, 6],
];
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 @@ -20,7 +20,7 @@
| 4 | X | 22.10.30😥 |
| 5 | 몰라몰라몰라 | |
| 6 | O | 22.11.01 |
| 7 || O |
| 7 || 22.11.01 |
| 8 || O |
| 9 || O |
| 10 || O |
Expand Down

0 comments on commit 7bc69ea

Please sign in to comment.