【leetcode❤python】 168. Excel Sheet Column Title

时间:2022-05-24 00:57:05

class Solution(object):
    def convertToTitle(self, n):
        """
        :type n: int
        :rtype: str
        """
        res=''
        while n>0:
            tmp=n
            n=(n-1)/26
            res+=chr(65+(tmp-1)%26)
        
        return res[::-1]