【leetcode❤python】 168. Excel Sheet Column Title

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]

posted @ 2016-11-13 19:30  火金队长  阅读(190)  评论(0编辑  收藏  举报