class Solution {
public int titleToNumber(String s) {
// System.out.println((int)('B' - 'A')+1);
int n = s.length();
int res = 0;
for (int i = 0; i < n; i++) {
res *= 26;
res += (s.charAt(i) - 'A')+1;
}
return res;
}
}
/*
Z -> 26
Y -> 25
ZY
26*26 + 25
26*26 = 676
676+25 = 701
like the cal number => 213 = 2*10*10 + 1*10 + 3
=> 2
=> 2*10 + 1
=> (2*10 + 1)*10 + 3 = 213
BCM
=>
B*26*26 + C*26 + M
1. B
2. B*26 + C
3. (B*26 + C)*26 + M
*/