Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
leetcode: finished #179
Browse files Browse the repository at this point in the history
  • Loading branch information
xqm32 committed Aug 2, 2023
1 parent 1402d5e commit a954415
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions content/leetcode/2023/8.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@ title: "2023.8"
draft: false
---

# 2023.8.2

```python
#
# @lc app=leetcode.cn id=179 lang=python3
#
# [179] 最大数
#

# @lc code=start
from functools import cmp_to_key
from typing import List


class Solution:
def largestNumber(self, nums: List[int]) -> str:
def compare(x, y):
return int(str(y) + str(x)) - int(str(x) + str(y))

nums = sorted(nums, key=cmp_to_key(compare))
return str(int("".join(map(str, nums))))


# @lc code=end
```

# 2023.8.1

```python
Expand Down

0 comments on commit a954415

Please sign in to comment.