https://leetcode.com/problems/excel-sheet-column-number/#/description
和上一题类似,这里相当于是一个逆过程
public class Solution { public int titleToNumber(String s) { int num = 0; for (int i = 0; i < s.length(); i++) { num = num * 26 + (s.charAt(i) - 'A' + 1); } return num; } }
Last updated 5 years ago