class Solution {
public:
int titleToNumber(string s) {
int result = 0;
for (int i = s.size()  1; i >= 0; i)
result += (s[i]  'A' + 1) * pow(26, s.size()  1  i);
return result;
}
};
My solution is below

Hey, here is my solution, I think we have the same idea, is there a better solution?
public int titleToNumber(String s) { if(s == null  s.length() <= 0){ return 0; } byte[] b = s.getBytes(); int sum = 0; for(int i = 0 ; i < b.length ; i++){ sum += (b[i]  64)*Math.pow(26, b.length  i  1); } return sum; }