leetcode 171. Excel Sheet Column Number

来源:互联网 发布:淘宝店铺阶层 编辑:程序博客网 时间:2024/05/18 14:27
class Solution {public:    int titleToNumber(string s) {        int ans = 0;        for(int i = 0;i < s.length(); i++){            ans = ans * 26 + s[i]-'A'+1;        }        return ans;    }};

0 0