6 line Python solution (39ms)


  • 0

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


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.