LeetCode 171 Excel Sheet Column Number
概述
https://leetcode.com/problems/excel-sheet-column-number/
解法
class Solution {
public:
int titleToNumber(string columnTitle) {
int ans = 0;
for (auto c : columnTitle) {
ans *= 26;
ans += c - 'A' + 1;
}
return ans;
}
};