Leetcode 171 Solution

This article provides solution to leetcode question 171 (excel-sheet-column-number)

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;
    }
};