# Excel Sheet Column Title

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 

class Solution {
public:
string convertToTitle(int n) {
string ans="";
int k=0;
while(n)
{
k=n%26;
if(k==0)
{
k=26;
}
ans+=('A'+k-1);
n-=k;
n/=26;
}
int left=0;
int right=ans.length()-1;

while(left<right)
{
char temp=ans[left];
ans[left]=ans[right];
ans[right]=temp;
left++;
right--;
}
return ans;
}
};

#### 168. Excel Sheet Column Title [easy] (Python)

2016-05-14 16:22:17

#### 168. Excel Sheet Column Title Excel表列名 和 171. Excel Sheet Column Number

2016-06-27 10:40:17

#### 168. Excel Sheet Column Title Leetcode Python

2015-02-15 03:09:32

#### 【LeetCode-面试算法经典-Java实现】【168-Excel Sheet Column Title（Excell列标题）】

2015-08-22 06:51:46

#### [LeetCode 168] Excel Sheet Column Title

2015-08-25 14:58:32

#### [LeetCode-171]Excel Sheet Column Number(java)

2016-10-08 21:14:02

#### LeetCode(171) Excel Sheet Column Number

2015-01-02 01:14:49

#### Leetcode: 168. Excel Sheet Column Title(JAVA)

2016-03-21 16:10:35

#### 1348. Excel Sheet Column Number

2018-06-17 16:10:19

#### 【leetcode】Excel Sheet Column Title【java】

2015-09-01 11:49:16