目录
题目
Given a column title as appear in an Excel sheet, return its corresponding column number.
Note:
A -> 1
B -> 2
C -> 3
…
Z -> 26
AA -> 27
AB -> 28
解决方案
1 | public class Solution { |
注意事项
- 遍历字符串,每一位的权重是26的(s.length() - 1 - i)次幂,结果求和即可。