[LeetCode] Excel Sheet Column Title

Well, this problem can be solved in 1-line clearly. Take a look at this link :-)

1 class Solution {
2 public:
3     string convertToTitle(int n) {
4         return !n ? "" : convertToTitle((n - 1) / 26) + char((n - 1) % 26 + 'A');
5     }
6 };

 

posted @ 2015-08-15 00:41  jianchao-li  阅读(195)  评论(0编辑  收藏  举报