171. Excel Sheet Column Number Easy

@problem@discussion
#Math#String



1/**
2 * [171] Excel Sheet Column Number
3 *
4 * Given a string columnTitle that represents the column title as appears in an Excel sheet, return its corresponding column number.
5 * For example:
6 * 
7 * A -> 1
8 * B -> 2
9 * C -> 3
10 * ...
11 * Z -> 26
12 * AA -> 27
13 * AB -> 28 
14 * ...
15 * 
16 *  
17 * Example 1:
18 * 
19 * Input: columnTitle = "A"
20 * Output: 1
21 * 
22 * Example 2:
23 * 
24 * Input: columnTitle = "AB"
25 * Output: 28
26 * 
27 * Example 3:
28 * 
29 * Input: columnTitle = "ZY"
30 * Output: 701
31 * 
32 *  
33 * Constraints:
34 * 
35 * 	1 <= columnTitle.length <= 7
36 * 	columnTitle consists only of uppercase English letters.
37 * 	columnTitle is in the range ["A", "FXSHRXW"].
38 * 
39 */
40pub struct Solution {}
41
42// problem: https://leetcode.com/problems/excel-sheet-column-number/
43// discuss: https://leetcode.com/problems/excel-sheet-column-number/discuss/?currentPage=1&orderBy=most_votes&query=
44
45// submission codes start here
46
47impl Solution {
48    pub fn title_to_number(column_title: String) -> i32 {
49        0
50    }
51}
52
53// submission codes end
54
55#[cfg(test)]
56mod tests {
57    use super::*;
58
59    #[test]
60    fn test_171() {
61    }
62}
63


Back
© 2025 bowen.ge All Rights Reserved.