share my five-live python solution which beats 97.19%


  • 0
    J
        # 168. Excel Sheet Column Title
        def convertToTitle(self, n):
            """
            :type n: int
            :rtype: str
            """
            res = ''
            while n > 0:
                res += chr(ord('A') + (n - 1) % 26)
                n = (n - 1) / 26
            return res[::-1]

Log in to reply
 

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