3 line C solution


  • 0
    Q

    int i, ans=0;
    for(i=strlen(s); i>0;i--) ans+=((tolower(s[i-1])-96)*pow(26,strlen(s)-i));
    return ans;


Log in to reply
 

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