Very Clean and easy understanding C++


  • 0
    T
    class Solution {
    public:
        int titleToNumber(string s) {
            int res = 0;
            for (const auto & c : s) {
                res = res * 26 + (c - 'A' + 1);
            }
            
            return res;
         }
    };
    

Log in to reply
 

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