leetcood学习笔记-171-excel表列序号

题目描述:

方法:

class Solution:
    def titleToNumber(self, s: str) -> int:
        num = 0
        r = 1
        for i in s[::-1]:
            num +=(ord(i)-64)*r
            r*=26
        return num

猜你喜欢

转载自www.cnblogs.com/oldby/p/10539731.html