Beauty of Programming[leetcode_171] Excel Sheet Column NumberFind the actual column number represented by an Excel column label like “AB”. It’s essentially base-26 conversion. 1 2 3 4 5 6 7 8 9 10 11 class Solution { public: int titleToNumber(string s) { int sum = 0; int size = s.length(); for (int i = 0; i < size; i++) { sum += (s[i] - 'A' + 1) * (int)pow(26.0, (size - i - 1)); } return sum; } };