leetcode中Excel Sheet Column Title问题

TIPS:这个问题与 http://zhanfang.github.io/2015/01/29/leetcode13/ 这个问题相对应

##问题描述
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 

该问题意思很清楚,就是要将数字转化问大写英文字符串
下面直接贴出代码,代码很容易懂,不做过多描述

##JAVA代码
public class Solution {
public String convertToTitle(int n) {
int x = n/26;
int y = n%26;
if(n<=0){
return “”;
}
if(x == 0){
return ((char)(y+64)) + “”;
}
if(y == 0){
return convertToTitle(x-1) + “Z”;
}
return convertToTitle(x) + convertToTitle(y);
}
}