Skip to content

Commit 5ce54e6

Browse files
committed
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

+1
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

+10
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)