My solution in C (4ms)


  • 0
    S
    int titleToNumber(char* s) {
    size_t n=strlen(s);
    int ans=0;int i;
    for(i=0;i<n;i++)
    {
        ans=ans*26 + s[i]-64;
        
    }
    return ans;
    }

Log in to reply
 

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