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

Commit

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

# 2024.1.26

```python
#
# @lc app=leetcode.cn id=2129 lang=python3
#
# [2129] 将标题首字母大写
#


# @lc code=start
class Solution:
def capitalizeTitle(self, title: str) -> str:
def cap(word):
if len(word) == 1 or len(word) == 2:
return word.lower()
else:
return word.capitalize()

words = title.split()
res = []
for word in words:
res.append(cap(word))
return " ".join(res)


# @lc code=end
```

# 2024.1.25

```python
Expand Down

0 comments on commit dc91a44

Please sign in to comment.