leetcode中Excel Sheet Column Number问题

##问题描述

Related to question Excel Sheet Column Title

Given a column title as appear in an Excel sheet, return its corresponding column number.

For example:

A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28 

该问题即要求计算出excle表格中块对应的数字
每一行有26个,换到下一行即AA,AB,AC,下下行BA,BB,BC
以此类推


#java代码
public class Solution {
public int titleToNumber(String s) {
int result = 0;
for (int i = 0; i < s.length(); result = result * 26 + (s.charAt(i) - ‘A’ + 1), i++);
return result;
}
}


##Tips

该问题比较简单,看一下代码就可以明白