3ms C++ solution


  • 0
    E
    class Solution {
    public:
        int titleToNumber(string s) {
            int result = 0;
            int pow = 26;
            for(char c : s)
            {
                result = result*pow + c - 'A' + 1;
            }
            
            return result;
        }
    };
    

Log in to reply
 

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