My C++ Solution


  • 0
    class Solution {
    public:
        int titleToNumber(string s) {
            int res = 0;
    		for (int i = 0; i < s.size(); i++)
    			res = res * 26 + s[i] - 'A' + 1;
    		return res;
        }
    };

Log in to reply
 

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