Open Shawngbk opened 7 years ago
参考168
public class Solution { public int titleToNumber(String s) { int res = 0; int len = s.length(); for(int i = 0; i < len; i++) { res = (s.charAt(i)-'A') + 1 + res*26; } return res; } }
uber microsoft
参考168
public class Solution { public int titleToNumber(String s) { int res = 0; int len = s.length(); for(int i = 0; i < len; i++) { res = (s.charAt(i)-'A') + 1 + res*26; } return res; } }