65. Excel column number

EasyProgramFree10 points

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

  1. Input: titleToNumber "A"Output: 1
  2. Input: titleToNumber "AB"Output: 28
  3. Input: titleToNumber "ZY"Output: 701

Submitting also runs 7 hidden tests.

Constraints

  • title has 1 to 7 upper-case letters, and its column number is at most 2,147,483,647.
Solution.lean
Loading editor…

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