Ac int just one line in the loop in c++


  • 0
    I
    class Solution {
    public:
    int titleToNumber(string s) {
        int res = 0;
        int loops = s.length();
        int index=0;
        while(loops >0){
            res += int(s[--loops]-'A'+1)*pow(26,index++);
            //loops--;
        }
        return res;
    }
    

    };


Log in to reply
 

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