Excel Sheet Column Number (LeetCode)
Question:
https://oj.leetcode.com/problems/excel-sheet-column-number/
之前是从数字转换到string,这题要求从string转换回数字。
class Solution { public: int titleToNumber(string s) { int value = 0; for (int i = 0; i < s.size(); i++) { value *= 26; value += (s[i] - 'A' + 1); } return value; } };