171. Excel表列序号
解法一:26进制
class Solution:
def titleToNumber(self, s: str) -> int:
count = 0 #幂次
res = 0 #累加和
for ch in s[::-1]:
res += (ord(ch) - 64) * 26 ** count
count += 1
return res最后更新于