Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB
python code
class Solution:
# @param {integer} n
# @return {string}
def convertToTitle(self, n):
a=''
while n is not 0:
a+=(chr(((n-1)%26)+65)) #26进制转换问题,跟十进制相似,注意一些细节问题就ok
n=(n-1)/26
return a[-1::-1]