Check out simple Cpp solution


#1

int Solution::titleToNumber(string A) {
int n=A.length();
reverse(A.begin(),A.end());
int ans=0;
for(int i=0;i<n;i++){
ans+=pow(26,i)*(A[i]-‘A’+1);
}
return ans;

}