Guest User

Untitled

a guest
Oct 15th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. def convertToTitle(self, n):
  2. """
  3. :type n: int
  4. :rtype: str
  5. """
  6. s = ""
  7. while (n > 0):
  8. d = (n % 26) - 1
  9. if d < 0:
  10. d = 25
  11. n = (n - 1) // 26
  12. s += chr(ord('A') + d)
  13.  
  14. return s[::-1]
Add Comment
Please, Sign In to add comment