标签:
No tricks.
1 class Solution { 2 public: 3 int titleToNumber(string s) { 4 int result = 0, len = s.size(); 5 for (int i = 0; i < len; i++) { 6 result = result*26 + int(s[i] - ‘A‘) + 1; 7 } 8 return result; 9 } 10 };
LeetCode – Refresh – Exceel Sheet Column Number
标签:
原文地址:http://www.cnblogs.com/shuashuashua/p/4349444.html