class Solution {
public:
int titleToNumber(string s) {
int t = 1;
int ans = 0;
for(int i = s.size() - 1; i >= 0; --i){
int n = s[i];
n -= 64;
ans += (n * t);
t *= 26;
}
return ans;
}
};
171. Excel Sheet Column Number
最新推荐文章于 2024-02-17 11:47:40 发布