标签:leetcode
https://oj.leetcode.com/problems/excel-sheet-column-number/
public class Solution {
public int titleToNumber(String s) {
if (s == null || s.isEmpty())
return 0; // invalid input
char[] chars = s.toCharArray();
int r = 0;
for (char c : chars)
{
r = r * 26 + (c - ‘A‘) + 1;
}
return r;
}
}[LeetCode]171 Excel Sheet Column Number
标签:leetcode
原文地址:http://7371901.blog.51cto.com/7361901/1601316