标签:
题目描述:public class Solution { public int TitleToNumber(string s) { var sum = 0; for(var i = s.Length - 1; i >= 0; i--){ var d = s.Length - i; var n = Num(s[i]); sum += (int)Math.Pow(26, d-1) * n; } return sum; } private int Num(char c) { return (int)c - 64; } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
LeetCode -- Excel Sheet Column Number
标签:
原文地址:http://blog.csdn.net/lan_liang/article/details/48575959