Excel Sheet Column Title
Description:
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
Example
1 -> A
2 -> B
3 -> C
…
26 -> Z
27 -> AA
28 -> AB
Code:
class Solution:
"""
@param n: a integer
@return: return a string
"""
def convertToTitle(self, n):
# write your code here
res = ''
while n:
res = chr(n%26+64) + res
n = math.floor(n/26)
return res