Leetcode 171 Solution
This article provides solution to leetcode question 171 (excel-sheet-column-number)
Access this page by simply typing in "lcs 171" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/excel-sheet-column-number
Solution
class Solution {
public:
int titleToNumber(string s) {
int v = 0;
for (auto it = s.begin(); it != s.end(); it++)
{
v = v * 26 + *it - 'A' + 1;
}
return v;
}
};