Excel Column Number
EasyP2Coding
Spreadsheet columns are named A, B, ..., Z, AA, AB, ..., AZ, BA, ... Given a column title as an upper-case string, return its column number, where A is 1.
Example 1
- Input
- columnTitle = "A"
- Output
- 1
Example 2
- Input
- columnTitle = "AB"
- Output
- 28
Example 3
- Input
- columnTitle = "ZY"
- Output
- 701
Constraints
- 1 <= columnTitle.length <= 7
- columnTitle consists of upper-case letters A-Z
- The title is at most "FXSHRXW" (2^31 - 1)
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 10. ⌘Enter runs, ⌘⇧Enter submits.