题目链接点击打开链接
public class Solution {
public int titleToNumber(String s) {
int length=s.length();
int weight=1;
int result=0;
for(int i=length-1;i>=0;i--)
{
result+=(s.charAt(i)-'A'+1)*weight;
weight*=26;
}
return result;
}
}