171. Excel Sheet Column Number 發表於 2023-02-13 | 分類於 leetcode problemsolution1234567891011class Solution {public: int titleToNumber(string columnTitle) { int ret = 0, n = columnTitle.size(); for(int i=0;i<n;i++){ ret = 26*ret ; ret+=columnTitle[i]-'A'+1; } return ret; }}; analysis time complexity O(n) space complexity O(1)