Easy understandable soln C++


#1
int Solution::titleToNumber(string A) {
     int N = A.size();
     int res = 0, p = 0;
     for(int i = N-1; i>=0; i--){
        int d = A[i] - 'A' + 1;
        res+=(d * pow(26,p));
        p+=1;
     }
     return res;
}