# 0168. Excel Sheet Column Title ###### tags: `Leetcode` `Easy` Link: https://leetcode.com/problems/excel-sheet-column-title/description/ ## 思路 相当于一个26进位的数字转换 columnNumber每次都需要-1 这样A才对应0, Z对应25 ## Code ```python= class Solution: def convertToTitle(self, columnNumber: int) -> str: s = "" while columnNumber != 0: s += chr((columnNumber-1)%26 + ord('A')) columnNumber = (columnNumber-1)//26 return s[::-1] ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up