fork download
  1. class Solution:
  2. def convertToTitle(self, cn: int) -> str:
  3. res = ""
  4. while cn:
  5. r = cn % 26
  6. if r == 0:
  7. res += "Z"
  8. cn -= 1
  9. else:
  10. res += chr(r + 64)
  11. cn //= 26
  12. return res[::-1]
Success #stdin #stdout 0.02s 9644KB
stdin
956
stdout
Standard output is empty