Skip to content

Commit 004604b

Browse files
committed
✨ largest number
1 parent 432377f commit 004604b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CATEGORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@
5050
https://ojeveryday.com/
5151

5252
https://labuladong.gitbook.io/algo/di-ling-zhang-bi-du-xi-lie/gitbook
53+
54+
https://github.com/garciparedes
55+
56+
https://garciparedes.me/#headers

src/179-largest-number/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {string}
4+
*/
5+
var largestNumber = function (nums) {
6+
return (
7+
nums
8+
.sort((x, y) => '' + y + x - ('' + x + y))
9+
.join('')
10+
.replace(/^0*/, '') || '0'
11+
);
12+
};

0 commit comments

Comments
 (0)