https://leetcode.com/problems/excel-sheet-column-title


Runtime: 32 ms, faster than 49.35% of Python3 online submissions for Excel Sheet Column Title.
Memory Usage: 14.2 MB, less than 70.76% of Python3 online submissions for Excel Sheet Column Title.



```python
import string


uppercase_ascii = list(string.ascii_uppercase)


def integer_to_letter(num):
    index = (num - ((num // 26)*26)) % 26
    return uppercase_ascii[index-1], num//26

class Solution:
    def convertToTitle(self, columnNumber: int) -> str:
        #6:08
        output = ""
        
        left = columnNumber
        
        if (left <= 26):
            return uppercase_ascii[left-1]
        
        while True:
            letter, left = integer_to_letter(left)
            output = letter + output
            
            #print(letter,left)
            
            if left <= 26:
                #print(letter,left)
                if (output[0] == "Z"):
                    output = uppercase_ascii[left-2] + output
                else:
                    output = uppercase_ascii[left-1] + output
                break
        
        return output.replace("AAZ", "ZZ")
        #6:40
        #debug until 6:57
```