class Solution:
def convertToTitle(self, cn: int) -> str:
res = ""
while cn:
r = cn % 26
if r == 0:
res += "Z"
cn -= 1
else:
res += chr(r + 64)
cn //= 26
return res[::-1]
Y2xhc3MgU29sdXRpb246CiAgICBkZWYgY29udmVydFRvVGl0bGUoc2VsZiwgY246IGludCkgLT4gc3RyOgogICAgICAgIHJlcyA9ICIiCiAgICAgICAgd2hpbGUgY246CiAgICAgICAgICAgIHIgPSBjbiAlIDI2CiAgICAgICAgICAgIGlmIHIgPT0gMDoKICAgICAgICAgICAgICAgIHJlcyArPSAiWiIKICAgICAgICAgICAgICAgIGNuIC09IDEKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHJlcyArPSBjaHIociArIDY0KQogICAgICAgICAgICBjbiAvLz0gMjYKICAgICAgICByZXR1cm4gcmVzWzo6LTFd