Short 8ms C++ solution


  • 0
    D
    class Solution {
    public:
        int titleToNumber(string s) {
            int result = 0;
            for (char c : s) {
                result = 26 * result + 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.