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

Commit

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

# 2023.8.25

```python
#
# @lc app=leetcode.cn id=38 lang=python3
#
# [38] 外观数列
#


# @lc code=start
class Solution:
def countAndSay(self, n: int) -> str:
if n == 1:
return "1"
else:
s = self.countAndSay(n - 1)
i = 0
j = 0
res = ""
while j < len(s):
if s[i] != s[j]:
res += str(j - i) + s[i]
i = j
j += 1
res += str(j - i) + s[i]
return res


# @lc code=end
```

# 2023.8.24

```python
Expand Down

0 comments on commit fa005d5

Please sign in to comment.