C++ recursive solution Excel Sheet Column Title (0ms)


  • 0
    M

    class Solution { public: string convertToTitle(int n) { if (n<27) return string(1,'A'+n-1); return convertToTitle((n-((n-1)%26+1))/26)+convertToTitle((n-1)%26+1); } };


Log in to reply
 

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