2023-12-09 18:42:21 +08:00
< p > Given a string < code > columnTitle< / code > that represents the column title as appears in an Excel sheet, return < em > its corresponding column number< / em > .< / p >
2022-03-27 20:56:26 +08:00
< p > For example:< / p >
< pre >
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
< / pre >
< p > < / p >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 1:< / strong > < / p >
2022-03-27 20:56:26 +08:00
< pre >
< strong > Input:< / strong > columnTitle = " A"
< strong > Output:< / strong > 1
< / pre >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 2:< / strong > < / p >
2022-03-27 20:56:26 +08:00
< pre >
< strong > Input:< / strong > columnTitle = " AB"
< strong > Output:< / strong > 28
< / pre >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 3:< / strong > < / p >
2022-03-27 20:56:26 +08:00
< pre >
< strong > Input:< / strong > columnTitle = " ZY"
< strong > Output:< / strong > 701
< / pre >
< p > < / p >
< p > < strong > Constraints:< / strong > < / p >
< ul >
< li > < code > 1 < = columnTitle.length < = 7< / code > < / li >
< li > < code > columnTitle< / code > consists only of uppercase English letters.< / li >
< li > < code > columnTitle< / code > is in the range < code > [" A" , " FXSHRXW" ]< / code > .< / li >
< / ul >