65. Excel column number
Spreadsheet columns are named A, B, …, Z, AA, AB, …, AZ, BA, …. Write titleToNumber title, the position of the column: A is 1, Z is 26, AA is 27.
Examples
Input: titleToNumber "A"Output: 1Input: titleToNumber "AB"Output: 28Input: titleToNumber "ZY"Output: 701
Submitting also runs 7 hidden tests.
Constraints
titlehas 1 to 7 upper-case letters, and its column number is at most 2,147,483,647.
Loading editor…
Type
\to in the editor, or click:Run checks your code against the examples and your custom inputs and records nothing. Submit also runs the hidden tests, confirms the axioms your proof uses and records the result. Each uses one compiler check.
ReadyLn 1, Col 1Lean 4
Draft saved in this browser