Straightforward Python solution


  • 12
    L

    Conversion from 10-ary numbers to 26-ary numbers. The tricky part is the lack of the equivalent number '0' in the 26-ary system.

    def convertToTitle(self, n):
        r = ''
        while(n>0):
            n -= 1
            r = chr(n%26+65) + r
            n /= 26
        return r

Log in to reply
 

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