c 4ms solution


  • 0
    W
    # c 4ms
    int titleToNumber(char* s) {
        int len = strlen(s)-1;
        int sum=0;
        while(len >=0){
            sum += (*s++-64)*pow(26, len--);
        }
        return sum;
    }

Log in to reply
 

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