标签:pre style color art public excel for ber let
这个题其实是做26进制转换
这个地方记得减大A,不是小a
class Solution { public: int titleToNumber(string s) { int length = s.size(); if(length <= 0) return 0; int num = 0; for(int i = 0;i < length;i++){ num = num*26 + (s[i] - ‘A‘ + 1); } return num; } };
https://blog.csdn.net/feliciafay/article/details/42332281
leetcode 171. Excel Sheet Column Number
标签:pre style color art public excel for ber let
原文地址:https://www.cnblogs.com/ymjyqsx/p/9652701.html