Easy Solution with logic


int Solution::titleToNumber(string A) {
//Find the length of string
int len=A.length();
long long int sum=0;
//AB=(26^1)value of A[i] + 26^0 value of A[i]
// For each character take the power of 26 with exponent=characters left
// Multiply with actual value of A[i]
//Sum all of them
for(int i=0;i<len;i++)
int temp=((int)A[i])-65+1;
int exp=len-i-1;

return sum;