Accepted 1ms C++ code


  • 1
    P
    class Solution {
    public:
        string convertToTitle(int n) {
            string s;
            do
    		{
    			n--;
                s=char((n%26)+'A')+s;
    		}
            while(n/=26);
            return s;
        }
    };

Log in to reply
 

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