[leetcode 168] Excel Sheet Column Title
2015-01-14 23:47
369 查看
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
For example:
1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB
class Solution { public: string convertToTitle(int n) { string res = ""; if (n<1) { return ""; } while (n) { n--; char c = n%26 + 'A'; res += c; n = n/26; } reverse(res.begin(),res.end()); return res; } };
相关文章推荐
- LeetCode 168. Excel Sheet Column Title
- LeetCode(168) Excel Sheet Column Title
- LeetCode - 168/171 - Excel Sheet Column Title/Number
- LeetCode 168: Excel Sheet Column Title
- Leetcode 168. Excel Sheet Column Title
- Leetcode_168_Excel Sheet Column Title
- [leetcode]168. Excel Sheet Column Title
- [LeetCode-168] Excel Sheet Column Title(10进制转26进制)
- LeetCode 171/168 Excel Sheet Column Number/Title
- [LeetCode] 168. Excel Sheet Column Title 求Excel表列名称
- [LeetCode]168. Excel Sheet Column Title
- 【LeetCode】168 & 171- Excel Sheet Column Title & Excel Sheet Column Number
- LeetCode-168. Excel Sheet Column Title
- [LeetCode]168. Excel Sheet Column Title
- leetcode-168 Excel Sheet Column Title
- [leetcode] 168.Excel Sheet Column Title
- leetcode 168: Excel Sheet Column Title
- [LeetCode]168. Excel Sheet Column Title(Excel表格列标题)
- [leetcode]168. Excel Sheet Column Title -- JavaScript 代码
- leetcode——168——Excel Sheet Column Title