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

Commit

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

# 2023.8.9

```python
#
# @lc app=leetcode.cn id=91 lang=python3
#
# [91] 解码方法
#


# @lc code=start
class Solution:
def numDecodings(self, s: str) -> int:
if not s:
return 0
dp = [0] * (len(s) + 1)
dp[0] = 1
for i in range(1, len(dp)):
if s[i - 1] != "0":
dp[i] += dp[i - 1]
if i > 1 and "10" <= s[i - 2 : i] <= "26":
dp[i] += dp[i - 2]
return dp[-1]


# @lc code=end
```

# 2023.8.8

```python
Expand Down

0 comments on commit 0527ee4

Please sign in to comment.