[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 @   jianchao-li  阅读(196)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示