首页 > 代码库 > LeetCode Excel Sheet Column Title

LeetCode Excel Sheet Column Title

class Solution {public:    string convertToTitle(int n) {        if (n <= 0) {            return "";        }        string res;        while (n>0) {            n--;            res = (char)(n % 26 + A) + res;            n /= 26;        }        return res;    }};

有些理不清,没有零的数进制,应该还是算第几个排列类型的

LeetCode Excel Sheet Column Title