168. Excel Sheet Column Title

https://leetcode.com/problems/excel-sheet-column-title/description/

class Solution {
public:
    string convertToTitle(int n) {
        string res;
        while (n > 0) {
            res.push_back((n-1) % 26 + 'A');
            n = (n-1) / 26;
        }
        reverse(res.begin(), res.end());
        return res;
    }
};
原文地址:https://www.cnblogs.com/JTechRoad/p/9040571.html