标签:
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 
类似于进制转换。
public class Solution {
      public int titleToNumber(String s) {
            int num = 0;
            for (char c : s.toCharArray()) {
                  num = num * 26 + c - ‘A‘ + 1;
            }
            return num;
      }
}
171. Excel Sheet Column Number
标签:
原文地址:http://www.cnblogs.com/shini/p/4421250.html