C++ , 0ms


  • 0
    B

    class Solution {
    public:
    string convertToTitle(int n) {
    string str ;
    char temp;
    int num;
    while(n)
    {
    num = (n-1)%26;
    temp = num+'A';
    str = temp + str;
    n = (n-1)/26;
    }
    return str;
    }
    };


Log in to reply
 

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