标签:
public class Solution { public String convertToTitle(int n) { return convertToTitle(--n / 26) + (char)('A' + (n % 26)); } }
public class Solution { public String convertToTitle(int n) { StringBuffer sb=new StringBuffer(); while(n>0){ --n; sb.append((char)(n%26+'A')); n/=26; } return sb.reverse().toString(); } }
LeetCode--Excel Sheet Column Title
标签:
原文地址:http://blog.csdn.net/wj512416359/article/details/42217601