给定一个正整数,返回它在Excel表中相对应的列名称。
示例:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
详见:https://leetcode.com/problems/excel-sheet-column-title/description/
实现语言:Java
class Solution { public String convertToTitle(int n) { String res=""; while(n!=0){ res=(char)((n-1)%26+'A')+res; n=(n-1)/26; } return res; } }
参考:https://www.cnblogs.com/ganganloveu/p/4175848.html