Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5ce54e6

Browse files
update: 179
1 parent d55c602 commit 5ce54e6

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ This is the solutions collection of my LeetCode submissions, most of them are pr
100100
| 175 | [Combine Two Tables](https://leetcode.com/problems/combine-two-tables/) | [SQL](./src/combine-two-tables/res.txt) | Easy |
101101
| 176 | [Second Highest Salary](https://leetcode.com/problems/second-highest-salary/) | [SQL](./src/second-highest-salary/res.txt) | Easy |
102102
| 177 | [Nth Highest Salary](https://leetcode.com/problems/nth-highest-salary/) | [SQL](./src/nth-highest-salary/res.txt) | Medium |
103+
| 179 | [largest-number](https://leetcode.com/problems/largest-number/) | [TypeScript](./src/largest-number/res.ts) | Medium |
103104
| 181 | [Employees Earning More Than Their Managers](https://leetcode.com/problems/employees-earning-more-than-their-managers/) | [SQL](./src/employees-earning-more-than-their-managers/res.txt) | Easy |
104105
| 182 | [Duplicate Emails](https://leetcode.com/problems/duplicate-emails/) | [SQL](./src/duplicate-emails/res.txt) | Easy |
105106
| 183 | [Customers Who Never Order](https://leetcode.com/problems/customers-who-never-order/) | [SQL](./src/customers-who-never-order/res.txt) | Easy |

‎src/largest-number/res.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function largestNumber(nums: number[]): string {
2+
const stringNums = nums.map(n=>n.toString());
3+
4+
stringNums.sort((a,b) => b+a > a+b ? 1: -1);
5+
const result = stringNums.join('');
6+
7+
if (result.indexOf('0') === 0) return '0';
8+
9+
return result;
10+
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /