福岛核厂辐射飙6万倍 “东京12万人恐患癌”(ZZ)# Stock
m*n
1 楼
第91题:
https://leetcode.com/problems/decode-ways/description/
一个答案是这样的:
class Solution(object):
def numDecodings(self, s):
"""
:type s: str
:rtype: int
"""
v, w, p = 0, int(s>''), ''
for d in s:
#v = w
#w = (d>'0')*w + (9 #p = d
v, w, p = w, (d>'0')*w + (9
return w
可是,注意那三行comment out的,如果分开写成3行,却是错误的,为什么?这种在一
行里面declare多个var和分开写的有什么区别
https://leetcode.com/problems/decode-ways/description/
一个答案是这样的:
class Solution(object):
def numDecodings(self, s):
"""
:type s: str
:rtype: int
"""
v, w, p = 0, int(s>''), ''
for d in s:
#v = w
#w = (d>'0')*w + (9
v, w, p = w, (d>'0')*w + (9
return w
可是,注意那三行comment out的,如果分开写成3行,却是错误的,为什么?这种在一
行里面declare多个var和分开写的有什么区别