© 1999-2048 dssz.net 粤ICP备11031372号
[其它] LeetCode刷题笔记——91. 解码方法
说明:难度:中等 一、题目描述: 二、解题分析: 1、解析 这一题比《剑指Offer》刷题笔记——面试题46. 把数字翻译成字符串麻烦了些,因为这里,0是不能翻的。 2、代码实现 class Solution: def numDecodings(self, s: str) -> int: dp = [0] * len(s) # 考虑第一个字母 if s[0] == "0": return 0 e<weixin_38740144> 上传 | 大小:45kb