Simplest C++ Solution


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

Log in to reply
 

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