LeetCode 168. Excel Sheet Column Title
- 2020 年 2 月 14 日
- 筆記
class Solution { public: string convertToTitle(int n) { string ans=""; while(n) { int x = (n-1) % 26; ans += ('A'+ x ); n = (n-1) / 26; } string res=""; for(int i=ans.length()-1;i>=0;i--) { res += ans[i]; } return res; } };