My 4ms solution


  • 0
    R

    class Solution {
    public:
    int titleToNumber(string s) {
    int sum=0;int i=0;
    while(s[i]!='\0')
    sum=sum*26+s[i++]-64;
    return sum;
    }
    };


Log in to reply
 

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