dsa · easy
Excel Sheet Column Number
Excel columns are titled A, B, …, Z, then AA, AB, …, ZY, ZZ, AAA, and so on (A is 1, not 0). Given a title column_title of uppercase letters, return its 1-based column number.
Arguments
column_title— Excel-style uppercase column title such as "AB"
Example
"A" → 1.
"AB" → 26*1 + 2 = 28.
"ZY" → 26*26 + 25 = 701.
Constraints
1 <= column_title.length <= 7 column_title contains only uppercase English letters the corresponding number is at most 2^31 - 1 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.
Examples
Example 1
Input: 'A' Expected: 1
Example 2
Input: 'AB' Expected: 28
Example 3
Input: 'ZY' Expected: 701