0ms C++ solution but only beat 1.3%


  • 1
    string convertToTitle(int n) {
        string s="";
        while(n){
            char c=(n%26)?(n%26+64):'Z';
            s = (char)c+s;
            n =(n-1)/26;
        }
        return s;
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.