LeetCode 171. Excel Sheet Column Number

  • 2020 年 2 月 14 日
  • 筆記

题目

class Solution {  public:      int titleToNumber(string s) {            int ans=0;          for(int i=0;i<s.length();i++)          {              ans*=26;              ans+=s[i]-'A'+1;            }            return ans;        }  };