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

Commit

Permalink
leetcode: finished #820
Browse files Browse the repository at this point in the history
  • Loading branch information
xqm32 committed Jan 7, 2024
1 parent abedbe2 commit f8ab473
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions content/leetcode/2024/1.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@ title: 2024.1
draft: false
---

# 2024.1.7

```python
#
# @lc app=leetcode.cn id=820 lang=python3
#
# [820] 单词的压缩编码
#

# @lc code=start
from typing import List


class Solution:
def minimumLengthEncoding(self, words: List[str]) -> int:
words = sorted(words, key=lambda x: len(x), reverse=True)
res = ""
for word in words:
if word + "#" not in res:
res += word + "#"
return len(res)


# @lc code=end
```

# 2024.1.6

```python
Expand Down

0 comments on commit f8ab473

Please sign in to comment.