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 这题题目的意思就是:将26进制字母转化为10进制数字
class Solution { public: int titleToNumber(string s) { int n=0; for(int i=0;i<s.size();i++) { n=n*26+(s[i]-‘A‘+1); return n; } } };
编译的时候开始总是出现
时间: 2024-10-08 05:16:29