1730. Spreadsheet Notation Conversion
很像 171. Excel Sheet Column Number 的reverse version.
class Solution:
"""
@param index: the index to be converted
@return: return the string after convert.
"""
def convert(self, index):
head, n = (index-1)//702+1, (index-1)%702+1
string = ""
while n > 0:
n, remainder = divmod(n - 1, 26)
string = chr(65 + remainder) + string
return str(head)+string
Last updated
Was this helpful?