We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1643d8 commit 723e510Copy full SHA for 723e510
yulrang/03_Queue/04_Unusual_sort.js
@@ -0,0 +1,7 @@
1
+function solution(numlist, n) {
2
+ var answer = [];
3
+
4
+ answer = numlist.sort((a,b) => (Math.abs(n-a) - Math.abs(n-b)) || (b-a));
5
6
+ return answer;
7
+}
0 commit comments