3lines solution C++


  • 0
    B
    int titleToNumber(string s) {
        int ret = 0;
        for(int i = 0;i<s.size();i++)  ret = ret*26 + (s[i]-64);
        return ret;
    }

Log in to reply
 

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