Simple and easy to understand


#1

int Solution::titleToNumber(string A) {
int len = A.length();
int res = 0;
for(int i=0;i<len;i++){
res += ((int)A[len-i-1] - 64)*pow(26,i);
}
return res;
}