Why Memory Limit Exceed?


  • 1
    C

    is it related to the use of string?

    class Solution {
    public:
        string convertToTitle(int n) {
            string a;
            while(n>26){
                n = n-26;
                a +='A';
            }            
            a += n+'A'-1;
            return a;
        }
    };

Log in to reply
 

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